Skip to content

test: add integration test for webhook deletion and verify no future … - #528

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
wagmiiii:test/506-webhook-deletion
Jun 27, 2026
Merged

test: add integration test for webhook deletion and verify no future …#528
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
wagmiiii:test/506-webhook-deletion

Conversation

@wagmiiii

Copy link
Copy Markdown
Contributor

Closes #506

Summary

This PR fulfils the requirement to ensure deleted webhooks do not receive future payload deliveries and properly returns a 204 No Content upon successful deletion.

What Changed

  • Modified the deleteWebhookHandler in webhook.controllers.ts to return res.status(204).end() instead of sendSuccess with a 200 status.
  • Updated existing unit and integration tests to expect the 204 status code.
  • Added a new comprehensive integration test that provisions a webhook, deletes it, simulates a trade event, and asserts that no delivery records (WebhookEvent) are generated for the deleted webhook.

Key Design Decisions

  • Discrepancy Addressed: The original codebase was returning a 200 OK with a JSON payload for the webhook deletion route. To strictly adhere to the issue's acceptance criteria, I changed this to return a 204 No Content, which drops the JSON response body entirely. The tests were updated to reflect this correct HTTP semantics.

Acceptance Criteria

  • DELETE returns 204
  • Webhook record no longer exists after deletion
  • No delivery attempted after deletion on subsequent trade event

Test Output & Coverage

The test suite passes successfully. Coverage for the modified controller is excellent at 85.71% (the only uncovered paths are defensive 500 catch blocks and missing ID safety checks).

PASS src/modules/webhooks/webhook.controllers.test.ts
PASS src/modules/webhooks/webhook.integration.test.ts

------------------------|---------|----------|---------|---------|-------------------
File                    | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------------|---------|----------|---------|---------|-------------------
webhook.controllers.ts  |   85.71 |       75 |     100 |   85.71 | 49,61,73-74,88
------------------------|---------|----------|---------|---------|-------------------

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@wagmiiii 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

@Chucks1093
Chucks1093 merged commit dbf303f into accesslayerorg:main Jun 27, 2026
1 check passed
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 integration test for webhook deletion removing the record and stopping future deliveries

2 participants