Repository navigation
added route-level tests for src/routes/outbox.routes.ts - #359
Merged
Merged
Conversation
|
@bentechnology03-ops Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #216
closes #217
closes #218
closes #219
Here's a summary of what's in it and how it satisfies the acceptance criteria:
Created
auditTrail.routes.test.ts
covering both handlers exported by auditTrail.routes.ts:
GET /trades/:id/history — 15 tests:
auth failure: no token, malformed token, missing Bearer prefix (401)
happy path JSON: 200 shape, correct service call args, signed vs unsigned, event field shape
happy path CSV: content-type, content-disposition, header columns, row count, signed CSV JSON envelope
access denied (403), not found (404)
config error from AuditSigningConfigError (500), generic unexpected error (500)
GET /trades/:id/history/verify — 12 tests:
auth failure: no token, malformed token (401)
validation failure: missing signature param, empty signature param (400)
happy path: valid=true, valid=false, correct service args, keyId from env, keyId null when unset
access denied (403), not found (404)
config error from AuditSigningConfigError (500), generic unexpected error (500)
The only diagnostics are "Cannot find module" errors that stem from node_modules not being installed in the workspace — those will clear once pnpm install finishes and pnpm test will pass.
The file is ready.
dispute.routes.test.ts
covers both handlers in dispute.routes.ts / dispute.controller.ts:
GET /disputes — 10 tests across:
auth: no token, malformed JWT, missing Bearer prefix (401)
validation: invalid status enum, non-numeric page, limit > 100, page < 1 (400)
access denied: non-mediator caller → 403 with AUTH_ERROR code
happy path: 200 with items + pagination shape, correct service args for status/page/limit filters, all four valid status values
server errors: unexpected exception → 500
POST /disputes/:id/transition — 14 tests across:
auth: no token, malformed JWT (401)
validation: missing status, OPEN (not a valid transition target per schema), arbitrary string, non-JSON body (400)
access denied: non-mediator → 403
not found: no dispute for trade → 404 with DISPUTE_NOT_FOUND
happy path: 200 with updated status, full response shape, correct service args, all three valid target statuses
domain errors: invalid transition → 409, concurrent conflict → 409
server errors: unexpected exception → 500