fix(webhooks): use local server in tests#5163
Merged
Conversation
The webhooks tests have been flacky lately. Tests in `webhooks` package are sending requests over the internet. Starting a local server to be used in the tests and avoid making requests over the network
🤖 My Senior Dev5 files reviewed • 2 need attention
💬 Try: 📖 All commands & personasYou can interact with me by mentioning In PR comments or on any line of code:
Slash commands:
AI Personas (mention to get their perspective):
For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews. |
marcindobry
approved these changes
Dec 18, 2025
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.
The webhooks tests have been flacky lately.
Tests in
webhookspackage are sending requests over the internet. Starting a local server to be used in the tests and avoid making requests over the networkLocal HTTP server replaces external endpoints in webhook tests
Introduces a reusable
TestWebhookServerhelper that spins up a local HTTP endpoint responding with 200/JSON to eliminate real network calls from the webhook unit tests. All webhook-related test suites now create and tear down a dedicated server instance, update fixture URLs to useTestWebhookServerendpoints, and assert against the resolved URLs instead of hard-coded internet addresses.Key Changes
• Added
TestWebhookServerhelper inpackages/webhooks/lib/helpers/test.tsto provide local webhook endpoints for tests.• Updated
auth,sync,asyncAction, andforwardwebhook unit tests to manage helper lifecycles withbeforeAll/afterAlland reset mocks pre-test.• Replaced hard-coded external URLs in expectations with
webhookSettings.primary_url/webhookSettings.secondary_urldrawn from the test server.Affected Areas
•
packages/webhooks/lib/helpers/test.ts•
packages/webhooks/lib/auth.unit.test.ts•
packages/webhooks/lib/sync.unit.test.ts•
packages/webhooks/lib/asyncAction.unit.test.ts•
packages/webhooks/lib/forward.unit.test.tsThis summary was automatically generated by @propel-code-bot