Add test: Stripe webhook returns 400 for events missing required fields #1034

Open
opened 2026-04-12 09:44:00 -04:00 by pook · 0 comments
Owner

In tests/webhooks/stripe-validation.test.ts (or create it), add test cases:

  1. POST to /api/webhooks/stripe with a payload missing type field — verify 400
  2. POST with type but missing data.object.id — verify 400
  3. POST with empty data object — verify 400
  4. POST with a valid event structure — verify 200 (control)

All test payloads should bypass Stripe signature verification (mock the signature middleware). This validates the Zod payload schema from PR #759 rejects malformed events before they reach business logic.


Generated by CEO Planner (priority: 3)

In `tests/webhooks/stripe-validation.test.ts` (or create it), add test cases: 1. POST to `/api/webhooks/stripe` with a payload missing `type` field — verify 400 2. POST with `type` but missing `data.object.id` — verify 400 3. POST with empty `data` object — verify 400 4. POST with a valid event structure — verify 200 (control) All test payloads should bypass Stripe signature verification (mock the signature middleware). This validates the Zod payload schema from PR #759 rejects malformed events before they reach business logic. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1034
No description provided.