Skip to content

fix(webhooks): use local server in tests#5163

Merged
TBonnin merged 1 commit intomasterfrom
tbonnin/dec15/webhook-flacky-test
Dec 18, 2025
Merged

fix(webhooks): use local server in tests#5163
TBonnin merged 1 commit intomasterfrom
tbonnin/dec15/webhook-flacky-test

Conversation

@TBonnin
Copy link
Collaborator

@TBonnin TBonnin commented Dec 16, 2025

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


Local HTTP server replaces external endpoints in webhook tests

Introduces a reusable TestWebhookServer helper 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 use TestWebhookServer endpoints, and assert against the resolved URLs instead of hard-coded internet addresses.

Key Changes

• Added TestWebhookServer helper in packages/webhooks/lib/helpers/test.ts to provide local webhook endpoints for tests.
• Updated auth, sync, asyncAction, and forward webhook unit tests to manage helper lifecycles with beforeAll/afterAll and reset mocks pre-test.
• Replaced hard-coded external URLs in expectations with webhookSettings.primary_url/webhookSettings.secondary_url drawn 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.ts


This summary was automatically generated by @propel-code-bot

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
@TBonnin TBonnin requested a review from a team December 16, 2025 21:48
@my-senior-dev-pr-review
Copy link

🤖 My Senior Dev

5 files reviewed • 2 need attention

⚠️ Needs Attention:

  • packages/webhooks/lib/helpers/test.ts — The new TestWebhookServer implements key test functionality but has critical logic and maintainability issues that need attention before merging.

View full analysis →


💬 Try: @my-senior-dev explain this change or summon @chaos-monkey 🐵 @security-auditor 🔒 @optimizer ⚡ for different perspectives

📖 All commands & personas

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

@TBonnin TBonnin added this pull request to the merge queue Dec 18, 2025
Merged via the queue into master with commit e9bb992 Dec 18, 2025
24 checks passed
@TBonnin TBonnin deleted the tbonnin/dec15/webhook-flacky-test branch December 18, 2025 14:01
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.

2 participants