Add subscription tier monthly limit check unit tests #1208

Open
opened 2026-04-12 20:16:07 -04:00 by pook · 0 comments
Owner

Create unit tests for the subscription tier monthly document generation limit logic. Validates acceptance criteria for issue #1193.

Test file: tests/billing/tier-limits.test.ts (match project conventions)

Test cases:

  1. User under monthly limit — check returns { allowed: true, remaining: }
  2. User at monthly limit — check returns { allowed: false, remaining: 0 }
  3. User over monthly limit — returns 429 with { error: 'Monthly document limit exceeded', limit: , resetDate: '' }
  4. New billing period — counter resets, user can generate again
  5. Different tiers have different limits — verify: free=1, starter=10, pro=50, enterprise=unlimited (or whatever the tier config defines)
  6. No subscription — falls back to free tier limit

Mock the subscription status lookup and document count query. Test the limit calculation logic in isolation.

Acceptance: All 6 test cases pass. Tier-based rate limiting logic verified.


Generated by CEO Planner (priority: 3)

Create unit tests for the subscription tier monthly document generation limit logic. Validates acceptance criteria for issue #1193. Test file: `tests/billing/tier-limits.test.ts` (match project conventions) Test cases: 1. User under monthly limit — check returns { allowed: true, remaining: <number> } 2. User at monthly limit — check returns { allowed: false, remaining: 0 } 3. User over monthly limit — returns 429 with { error: 'Monthly document limit exceeded', limit: <n>, resetDate: '<date>' } 4. New billing period — counter resets, user can generate again 5. Different tiers have different limits — verify: free=1, starter=10, pro=50, enterprise=unlimited (or whatever the tier config defines) 6. No subscription — falls back to free tier limit Mock the subscription status lookup and document count query. Test the limit calculation logic in isolation. Acceptance: All 6 test cases pass. Tier-based rate limiting logic verified. --- *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#1208
No description provided.