Skip to content

fix: add unit/integration tests closing #421 #422 #423 #424#486

Open
Userhorlie wants to merge 2 commits into
ANYTECHS:mainfrom
Userhorlie:fix/tests-421-422-423-424
Open

fix: add unit/integration tests closing #421 #422 #423 #424#486
Userhorlie wants to merge 2 commits into
ANYTECHS:mainfrom
Userhorlie:fix/tests-421-422-423-424

Conversation

@Userhorlie

Copy link
Copy Markdown
Contributor

Summary

Adds unit and integration tests for all four assigned issues.

#421 — NFT Ownership Verification tests

File: src/clips/nft-mint.service.spec.ts

The previous spec failed because new StellarSdk.Contract(contractId) throws Invalid contract ID before the circuit breaker mock can intercept. Fixed by:

  • Adding jest.mock('@stellar/stellar-sdk', ...) at module level so Contract() is a no-op
  • Adding configMock to the uploadMetadataToIPFS describe block (was missing, causing Cannot read properties of undefined)
  • Controlling scValToNative via sdk.default (the service uses the default import)

All 9 tests pass.

#422 — Stellar Subscription Payment tests

File: src/subscriptions/stellar-payment.service.spec.ts

Unit tests covering createPaymentIntent and processDetectedPayment — wallet not found, memo/destination, 15-min expiry, amount mismatch, idempotency, expired intent. 8 tests pass.

#423 — Payout Service tests

File: src/payouts/payouts.service.spec.ts

Unit tests for FeeService (percentage, fixed, min/max cap, default 1%) and PayoutsService.requestPayout (below minimum, duplicate pending, insufficient balance, valid stellar payout, non-stellar method). 10 tests pass.

#424 — Prisma Repository integration tests

File: test/prisma-repositories.integration-spec.ts

Integration tests for User, Wallet, Payout, Earning, StellarPaymentIntent repositories and transaction consistency using an in-memory fake — no real database needed. 20 tests pass under npm run test:e2e.

Test results

npm test (unit):   nft-mint.service 9/9, payouts.service 10/10, stellar-payment.service 8/8
npm run test:e2e:  prisma-repositories 20/20

Closes #421
Closes #422
Closes #423
Closes #424

…NYTECHS#423 ANYTECHS#424

- Fix nft-mint.service.spec.ts (ANYTECHS#421): mock @stellar/stellar-sdk at
  module level so Contract() does not throw on contract ID validation
  before the circuit breaker can intercept; add configMock to the
  uploadMetadataToIPFS describe block; control scValToNative via
  sdk.default (default import). All 9 tests now pass.

- Add stellar-payment.service.spec.ts (ANYTECHS#422): unit tests covering
  createPaymentIntent (wallet not found, memo/destination, expiry) and
  processDetectedPayment (match, mismatch, idempotency, expiry). 8 tests.

- Add payouts.service.spec.ts (ANYTECHS#423): unit tests for FeeService
  (percentage, fixed, min, max, default) and PayoutsService.requestPayout
  (below min, duplicate pending, insufficient balance, valid, non-stellar
  method). 10 tests.

- Add test/prisma-repositories.integration-spec.ts (ANYTECHS#424): integration
  tests for User, Wallet, Payout, Earning, StellarPaymentIntent
  repositories and transaction consistency using an in-memory fake.
  20 tests. Runs under jest-e2e.json (npm run test:e2e).

Closes ANYTECHS#421
Closes ANYTECHS#422
Closes ANYTECHS#423
Closes ANYTECHS#424
@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@Userhorlie 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! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

1 participant