Agreement Integration Test Suite (corrected endpoints)
Depends on: #61 (for activity assertions)
Task Description
Add/extend integration tests for the Agreements module. A Jest setup already exists (jest.config.js, src/integration/migrated-flows.integration.spec.ts, plus module .spec.ts files), so this builds on the existing suite rather than starting new. The goal is trustworthy coverage of the real endpoints and their error paths.
Background / Current State
- The original test issue referenced
GET /agreements, which does not exist — the real route is GET /agreements/by-wallet.
PATCH /agreements/:id/link-contract was missing from the original list and must be covered.
Deliverable
An integration test suite covering the real Agreements endpoints and their error paths.
Requirements
Test the actual endpoints (corrected against the current controller):
| Endpoint |
Method |
/agreements |
POST |
/agreements/by-wallet?wallet= |
GET (not GET /agreements) |
/agreements/:id |
GET |
/agreements/:id/link-contract |
PATCH (was missing originally) |
/agreements/:id/status |
PATCH |
/agreements/:id/milestones |
PATCH |
/agreements/:id/activity |
GET |
/agreements/by-contract/:contractId |
GET |
- Happy path + error path for each (invalid token, not found, unauthorized wallet).
- Assert activity entries are created on status/milestone changes (depends on Issue A).
Validation System
- All tests pass in CI (
pnpm test) before merge.
- Each endpoint has at least one success and one failure case.
Technical Requirements
- Reuse the existing Jest config and Supabase mock utilities already in the repo.
- Use a test JWT/wallet fixture.
- Do not introduce a parallel test harness — extend the current suite.
Additional Notes
The corrected endpoint list is the key value here: the original issue would have produced tests against a non-existent GET /agreements route. This issue fixes that and adds link-contract.
Testing (required)
Proof of Completion (required)
Agreement Integration Test Suite (corrected endpoints)
Depends on: #61 (for activity assertions)
Task Description
Add/extend integration tests for the Agreements module. A Jest setup already exists (
jest.config.js,src/integration/migrated-flows.integration.spec.ts, plus module.spec.tsfiles), so this builds on the existing suite rather than starting new. The goal is trustworthy coverage of the real endpoints and their error paths.Background / Current State
GET /agreements, which does not exist — the real route isGET /agreements/by-wallet.PATCH /agreements/:id/link-contractwas missing from the original list and must be covered.Deliverable
An integration test suite covering the real Agreements endpoints and their error paths.
Requirements
Test the actual endpoints (corrected against the current controller):
/agreements/agreements/by-wallet?wallet=GET /agreements)/agreements/:id/agreements/:id/link-contract/agreements/:id/status/agreements/:id/milestones/agreements/:id/activity/agreements/by-contract/:contractIdValidation System
pnpm test) before merge.Technical Requirements
Additional Notes
The corrected endpoint list is the key value here: the original issue would have produced tests against a non-existent
GET /agreementsroute. This issue fixes that and addslink-contract.Testing (required)
pnpm test.Proof of Completion (required)
pnpm testoutput showing the Agreements suite.GET /agreements/by-walletand includePATCH /agreements/:id/link-contract.