fix: lazy Stripe init (unblocks test suite) + add auth/keys unit tests
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 9m47s
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 9m47s
- billing.ts: Stripe now initialized lazily via getStripe() instead of at module load This prevents test suite crash when STRIPE_SECRET_KEY env var is not set - Add src/middleware/__tests__/auth.test.ts (6 tests): key extraction from Bearer header, X-API-Key header, query param; 401/403 responses; priority order - Add src/services/__tests__/keys.test.ts (6 tests): getTierLimit for all tiers - Total: 61 tests passing, 0 failures
This commit is contained in:
parent
c3dabc2ac6
commit
f696cb36db
3 changed files with 171 additions and 14 deletions
28
src/services/__tests__/keys.test.ts
Normal file
28
src/services/__tests__/keys.test.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { describe, it, expect } from 'vitest'
|
||||
import { getTierLimit } from '../keys.js'
|
||||
|
||||
describe('getTierLimit', () => {
|
||||
it('should return 100 for free tier', () => {
|
||||
expect(getTierLimit('free')).toBe(100)
|
||||
})
|
||||
|
||||
it('should return 1000 for starter tier', () => {
|
||||
expect(getTierLimit('starter')).toBe(1000)
|
||||
})
|
||||
|
||||
it('should return 5000 for pro tier', () => {
|
||||
expect(getTierLimit('pro')).toBe(5000)
|
||||
})
|
||||
|
||||
it('should return 25000 for business tier', () => {
|
||||
expect(getTierLimit('business')).toBe(25000)
|
||||
})
|
||||
|
||||
it('should return 100 for unknown tier', () => {
|
||||
expect(getTierLimit('enterprise')).toBe(100)
|
||||
})
|
||||
|
||||
it('should return 100 for empty string', () => {
|
||||
expect(getTierLimit('')).toBe(100)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue