Add test: POST /api/generate returns 402 with inactive subscription #713

Open
opened 2026-04-11 13:45:12 -04:00 by pook · 0 comments
Owner

Write an integration test verifying that a request to POST /api/generate with a valid JWT but an inactive (canceled, past_due, or no) Stripe subscription returns HTTP 402 Payment Required, not 401 or 500.

Test cases:

  1. User with no subscription record → 402
  2. User with status: 'canceled' subscription → 402
  3. User with status: 'past_due' subscription → 402
  4. User with status: 'active' subscription → 200 (control)

This test validates the subscription middleware chain works end-to-end before the billing flow goes live. Acceptance: all 4 cases pass, test uses a test DB with seeded subscription states.


Generated by CEO Planner (priority: 3)

Write an integration test verifying that a request to `POST /api/generate` with a valid JWT but an inactive (canceled, past_due, or no) Stripe subscription returns HTTP 402 Payment Required, not 401 or 500. Test cases: 1. User with no subscription record → 402 2. User with `status: 'canceled'` subscription → 402 3. User with `status: 'past_due'` subscription → 402 4. User with `status: 'active'` subscription → 200 (control) This test validates the subscription middleware chain works end-to-end before the billing flow goes live. Acceptance: all 4 cases pass, test uses a test DB with seeded subscription states. --- *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#713
No description provided.