Session 19: Sports design overhaul — player cards with headshots, game card redesign, scan page tonight's players, odds diagnostic logging, tier gate utility (1444 tests)

This commit is contained in:
Kev
2026-06-12 00:30:13 -04:00
parent 0e3839a90a
commit 56392ec8f4
12 changed files with 825 additions and 41 deletions
+22
View File
@@ -141,6 +141,28 @@ describe('oddsService', () => {
statusCode: 503,
});
});
// Session 19 — diagnostic log line. The 503 client-facing
// message is intentionally vague (no upstream leak); the log
// line is the operator's only signal. This test pins the log
// shape so a future "clean up logs" PR can't silently delete it.
it('logs upstream status + message before throwing 503', async () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
mockRedis.get.mockResolvedValue(null);
const apiErr = new Error('Request failed with status code 401');
apiErr.code = 'ERR_BAD_REQUEST';
apiErr.response = { status: 401, data: { message: 'Invalid API key' } };
axios.get.mockRejectedValue(apiErr);
await expect(getOdds('nba')).rejects.toMatchObject({ statusCode: 503 });
const logged = errorSpy.mock.calls.map((c) => c.join(' ')).join('\n');
expect(logged).toMatch(/oddsService/);
expect(logged).toMatch(/nba/);
expect(logged).toMatch(/upstream_status=401/);
expect(logged).toMatch(/Invalid API key/);
errorSpy.mockRestore();
});
});
describe('getOdds - quota management', () => {