Session 14: Africa checkout, Tank01 NBA/MLB wiring, WNBA+MLB odds proxies, OAuth icons, loading skeletons (1330 tests)

This commit is contained in:
Kev
2026-06-11 10:06:49 -04:00
parent 10159209fa
commit f5d79cf70d
22 changed files with 979 additions and 27 deletions
+44
View File
@@ -111,6 +111,50 @@ describe('POST /api/stripe/checkout', () => {
.send({ tier: 'analyst' })
.expect(401);
});
describe('Session 14 — Africa tier checkout', () => {
const originalAfricaPrice = process.env.STRIPE_PRICE_AFRICA;
afterAll(() => {
if (originalAfricaPrice == null) delete process.env.STRIPE_PRICE_AFRICA;
else process.env.STRIPE_PRICE_AFRICA = originalAfricaPrice;
});
test("'africa' is now an accepted tier (validation passes)", async () => {
setupAuthMocks();
process.env.STRIPE_PRICE_AFRICA = 'price_africa_test';
const res = await request(app)
.post('/api/stripe/checkout')
.set('Authorization', 'Bearer valid-token')
.send({ tier: 'africa' });
// We DON'T assert on the status here — the downstream Stripe
// mock may produce 200 OR the test's supabase fake may take a
// different path. The important assertion: the request didn't
// 400 with "tier must be analyst or desk".
expect(res.status).not.toBe(400);
});
test('returns 503 with code:tier_unconfigured when STRIPE_PRICE_AFRICA is unset', async () => {
setupAuthMocks();
delete process.env.STRIPE_PRICE_AFRICA;
const res = await request(app)
.post('/api/stripe/checkout')
.set('Authorization', 'Bearer valid-token')
.send({ tier: 'africa' })
.expect(503);
expect(res.body.code).toBe('tier_unconfigured');
expect(res.body.error).toMatch(/africa/i);
});
test('still rejects unrelated tiers with 400', async () => {
setupAuthMocks();
const res = await request(app)
.post('/api/stripe/checkout')
.set('Authorization', 'Bearer valid-token')
.send({ tier: 'gold' })
.expect(400);
expect(res.body.error).toMatch(/tier/);
});
});
});
describe('POST /api/stripe/portal', () => {