Repository navigation
test(webhooks): cover webhook subscription lifecycle, filtering, and secret rotation (#2079) - #2204
Open
huangji6693-max wants to merge 1 commit into
Conversation
2 tasks
This branch has not been deployed
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 deterministic unit test coverage in
backend/src/__tests__/webhookService.test.tsfor the webhook subscription lifecycle and delivery filtering inbackend/src/services/webhookService.ts:registerSubscription(mappingcallbackUrl,eventTypes,isActive,createdAt,updatedAt),listSubscriptions, and idempotentdeleteSubscription(trueon deletion,falsewhen already deleted).WebhookService.isSupportedagainst allSUPPORTED_WEBHOOK_EVENT_TYPESand confirmsdispatchfilters out unsubscribed event types viaevent_types @> $1::jsonb.secret-v1->secret-v2->null), asserting thatx-remitlend-signature(t=<timestamp>,v1=<hmac_sha256>) updates to match the new secret, invalidates signatures under the previous secret, and is omitted once the secret is cleared.Closes #2079
Verification
node --experimental-vm-modules node_modules/jest/bin/jest.js src/__tests__/webhookService.test.ts: 17 passed, 0 failed.Payout Wallets
GBYWLISGOUWQ43VQEGXX6KRGDZ3CKAFFK3JXVLXKDO5TIFJUJ3OHJYOZ0x380C97bcbcAEf29DAc2d0ba7E180F1b4A7F38fddAyXYaA9Nf4z5fpLKY6DmubWe6D2qveMd79w8pEDNHcDw