fix: add unit/integration tests closing #421 #422 #423 #424#486
Open
Userhorlie wants to merge 2 commits into
Open
fix: add unit/integration tests closing #421 #422 #423 #424#486Userhorlie wants to merge 2 commits into
Userhorlie wants to merge 2 commits into
Conversation
…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
|
@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! 🚀 |
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.
Summary
Adds unit and integration tests for all four assigned issues.
#421 — NFT Ownership Verification tests
File:
src/clips/nft-mint.service.spec.tsThe previous spec failed because
new StellarSdk.Contract(contractId)throwsInvalid contract IDbefore the circuit breaker mock can intercept. Fixed by:jest.mock('@stellar/stellar-sdk', ...)at module level soContract()is a no-opconfigMockto theuploadMetadataToIPFSdescribe block (was missing, causingCannot read properties of undefined)scValToNativeviasdk.default(the service uses the default import)All 9 tests pass.
#422 — Stellar Subscription Payment tests
File:
src/subscriptions/stellar-payment.service.spec.tsUnit tests covering
createPaymentIntentandprocessDetectedPayment— 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.tsUnit tests for
FeeService(percentage, fixed, min/max cap, default 1%) andPayoutsService.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.tsIntegration 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
Closes #421
Closes #422
Closes #423
Closes #424