Repository navigation
test: add comprehensive test suites for batch operations atomicity, timeout/error handling, currency conversion accuracy, and webhook signature verification (#1042-#1045) - #1149
Merged
Kingsman-99 merged 1 commit intoOct 19, 2026
Conversation
…rrency conversion, and webhook verification (Stellar-split#1042-Stellar-split#1045) - Add batch operations atomicity test suite covering success batch, partial failure, rollback coordination, and consistency invariants (Stellar-split#1045) - Add timeout and error handling test suite covering request timeouts, network error classification/recovery, XDR/JSON parse errors, and validation (Stellar-split#1044) - Add currency conversion accuracy test suite covering oracle price calculations, multi-asset precision preservation, split rounding auditor, and numerical edge cases (Stellar-split#1043) - Add webhook signature verification test suite covering HMAC-SHA256 digests, invalid signature rejection, replay protection, and nonce tracking (Stellar-split#1042) - Initialize eventHandlers and expiries in OptimisticCache to support cache lifecycle events during rollback
|
@hartz0 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! 🚀 |
5 tasks
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.
What this fixes
This PR adds comprehensive test coverage for four critical SDK core systems:
What changed
Batch Operations Atomicity (Test batch operations atomicity #1045):
test/batchOperationsAtomicity.test.ts(13 tests) covering:InvoiceBatchProcessor.RollbackCoordinatoremittingsplitRollbackInitiatedandsplitRollbackCompletedevents.OptimisticCache.eventHandlersandexpiriesinOptimisticCache(src/cache/OptimisticCache.ts) to ensure clean cache lifecycle event dispatch during rollback.Timeout and Error Handling (Test timeout and error handling #1044):
test/timeoutAndErrorHandling.test.ts(17 tests) covering:withTimeoutandwithTimeoutOrThrowtriggeringRequestTimeoutErrorwith method context and cancellation viaAbortSignal.TimeoutManagerper-method timeout overrides and default fallback configuration.EscalationManager.isRetryable(transient 503, 429, ECONNREFUSED vs non-retryable 400, 404,InvoiceNotFoundError).executeWithRetry.FallbackChain.parseEnvelope.ValidationError.Currency Conversion Accuracy (Test currency conversion accuracy #1043):
test/currencyConversionAccuracy.test.ts(19 tests) covering:rate > 1.0, fractionalrate < 1.0, and 1:1 parity).convertFiatToAssetfiat-to-token conversions and rejection of non-positive exchange rates withOraclePriceError.normalizeAmountandtoOnChainAmount.PrecisionError.auditSplitRoundingensuring exact sum preservation.RoundingOverflowError.Webhook Signature Verification (Test webhook signature verification #1042):
test/webhookSignatureVerification.test.ts(22 tests) covering:sha256=andhmac-sha256=).webhook.validatedandwebhook.rejected).webhooks/verify.tsandwebhookValidator.ts.safeComparepreventing timing attacks.RingBufferStorefor webhook replay.Testing
Ran all newly created and default test suites using Vitest:
test/batchOperationsAtomicity.test.ts(13 passed)test/timeoutAndErrorHandling.test.ts(17 passed)test/currencyConversionAccuracy.test.ts(19 passed)test/webhookSignatureVerification.test.ts(22 passed)npm test(test/client.test.ts,test/retryPolicy.test.ts,test/network-environment.test.ts) (110 passed)Total: 7 test files, 181 tests passed, 0 failures.
Issues
closes #1045
closes #1044
closes #1043
closes #1042