Skip to content

test(payouts): add route integration coverage#493

Open
h1065153539-create wants to merge 1 commit into
CredenceOrg:mainfrom
h1065153539-create:test/payouts-route-integration
Open

test(payouts): add route integration coverage#493
h1065153539-create wants to merge 1 commit into
CredenceOrg:mainfrom
h1065153539-create:test/payouts-route-integration

Conversation

@h1065153539-create

Copy link
Copy Markdown

Summary

  • add focused supertest integration coverage for POST /api/payouts
  • cover happy-path settlement creation, optional defaults, zod validation envelopes, missing/insufficient auth, idempotency replay/mismatch, duplicate transaction upserts, and persistence failure mapping
  • import the payout route schema directly from schemas/payout.js so payouts tests do not depend on unrelated OpenAPI schema side effects from the barrel export

Closes #457

Validation

  • npm test -- payouts passed: 2 files, 13 tests
  • npm run test:coverage -- payouts executed the focused suite successfully, then failed only because the repo's global coverage thresholds are applied to all src/**/*.ts and src/sdk/** when running a subset
  • file-level coverage from coverage/coverage-final.json for src/routes/payouts.ts: statements 100%, functions 100%, branches 100%
  • git diff --check passed

Existing upstream failures observed

  • npm run lint currently fails before linting because eslint.config.js imports missing src/observability/eslint-plugin-logger-schema.js while only the .ts source exists.
  • npm run build is currently blocked by broad pre-existing TypeScript errors outside this change, including duplicate config keys, missing generated gRPC modules, bond.ts OpenAPI type augmentation, SDK constructor type drift, and other unrelated files.

Notes

  • The current payouts route only exposes create/upsert behavior at POST /api/payouts; there is no separate status-transition endpoint to exercise not-found transitions. The new tests cover the route's available conflict path through idempotency key mismatch and duplicate transaction-hash upsert semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add supertest integration coverage for the payouts route in src/routes/payouts.ts

1 participant