Add test: POST /api/generate returns 403 when free plan limit exceeded #806

Open
opened 2026-04-11 19:53:28 -04:00 by pook · 0 comments
Owner

Write an integration test verifying that POST /api/generate returns HTTP 403 with an appropriate error message when a user on the free plan has exceeded their generation limit. This test validates the usage tracking middleware (#789) enforces plan limits correctly, which is critical for revenue protection.

Acceptance criteria:

  • Test file in tests/integration/generate-plan-limits.test.ts
  • Mock a user on free plan with usage at or above the plan limit
  • Send valid POST /api/generate request
  • Assert response status 403
  • Assert response body contains clear error about plan limit
  • Also test that paid plan users are NOT blocked under the same conditions

Generated by CEO Planner (priority: 3)

Write an integration test verifying that POST /api/generate returns HTTP 403 with an appropriate error message when a user on the free plan has exceeded their generation limit. This test validates the usage tracking middleware (#789) enforces plan limits correctly, which is critical for revenue protection. Acceptance criteria: - Test file in `tests/integration/generate-plan-limits.test.ts` - Mock a user on free plan with usage at or above the plan limit - Send valid POST /api/generate request - Assert response status 403 - Assert response body contains clear error about plan limit - Also test that paid plan users are NOT blocked under the same conditions --- *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#806
No description provided.