Session 23: All-day intelligence layer — schedule, game lines, streaks, hot lists, stat filtering, ParlayAPI dead (1567 tests)
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// Unit: provider registry dead-provider handling (Session 23).
|
||||
//
|
||||
// ParlayAPI was marked `status: 'dead'` after Chrome Claude confirmed its
|
||||
// host no longer resolves. It must be excluded from every fallback chain
|
||||
// and the configured-providers list, while still resolving via getProvider
|
||||
// (the adapter + its mocked tests still reference the config).
|
||||
|
||||
const {
|
||||
getProvider, getFallbackChain, getConfiguredProviders, isDeadProvider,
|
||||
} = require('../../src/config/providers');
|
||||
|
||||
describe('provider registry — dead providers', () => {
|
||||
const saved = {};
|
||||
beforeAll(() => {
|
||||
// Configure keys so the chain/list filters are exercised on presence.
|
||||
for (const k of ['PARLAYAPI_KEY', 'ODDS_API_KEY', 'ODDSPAPI_KEY']) {
|
||||
saved[k] = process.env[k];
|
||||
process.env[k] = 'test-key';
|
||||
}
|
||||
});
|
||||
afterAll(() => {
|
||||
for (const [k, v] of Object.entries(saved)) {
|
||||
if (v === undefined) delete process.env[k];
|
||||
else process.env[k] = v;
|
||||
}
|
||||
});
|
||||
|
||||
test('parlayapi is flagged dead', () => {
|
||||
expect(isDeadProvider('parlayapi')).toBe(true);
|
||||
expect(getProvider('parlayapi')).not.toBeNull(); // config still resolves
|
||||
expect(getProvider('parlayapi').status).toBe('dead');
|
||||
});
|
||||
|
||||
test('dead provider is excluded from fallback chains', () => {
|
||||
const chain = getFallbackChain('historical_props', 'nba', null);
|
||||
expect(chain).not.toContain('parlayapi');
|
||||
});
|
||||
|
||||
test('dead provider is excluded from configured providers', () => {
|
||||
const ids = getConfiguredProviders().map((p) => p.id);
|
||||
expect(ids).not.toContain('parlayapi');
|
||||
});
|
||||
|
||||
test('live providers still appear in fallback chains', () => {
|
||||
const chain = getFallbackChain('closing_lines', 'nba', null);
|
||||
expect(chain).toContain('oddspapi');
|
||||
});
|
||||
|
||||
test('non-dead providers report isDeadProvider false', () => {
|
||||
expect(isDeadProvider('odds-api')).toBe(false);
|
||||
expect(isDeadProvider('tank01')).toBe(false);
|
||||
expect(isDeadProvider('nonexistent')).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user