Session 23: All-day intelligence layer — schedule, game lines, streaks, hot lists, stat filtering, ParlayAPI dead (1567 tests)
This commit is contained in:
@@ -142,5 +142,28 @@ describe('tank01MlbAdapter', () => {
|
||||
const games = await adapter.getMLBDailyScoreboard('20260611');
|
||||
expect(games[0].gameId).toBe('STALE');
|
||||
});
|
||||
|
||||
// Session 23 — game-level book-by-book betting odds.
|
||||
test('getMLBBettingOdds returns the raw body and caches at the odds TTL', async () => {
|
||||
mockAxiosGet.mockResolvedValueOnce({
|
||||
data: { body: { '20260612_ARI@CIN': { sportsBooks: [{ sportsBook: 'bet365', odds: {} }] } } },
|
||||
});
|
||||
const body = await adapter.getMLBBettingOdds('2026-06-12');
|
||||
expect(body['20260612_ARI@CIN']).toBeDefined();
|
||||
const [url] = mockAxiosGet.mock.calls[0];
|
||||
expect(url).toMatch(/getMLBBettingOdds\?gameDate=20260612/);
|
||||
expect(mockCacheTtls.get('tank01:mlb:odds:20260612')).toBe(adapter.__internals.TTL.odds);
|
||||
});
|
||||
|
||||
test('getMLBBettingOdds second call within TTL does not hit Tank01', async () => {
|
||||
mockAxiosGet.mockResolvedValueOnce({ data: { body: { g: {} } } });
|
||||
await adapter.getMLBBettingOdds('2026-06-12');
|
||||
await adapter.getMLBBettingOdds('2026-06-12');
|
||||
expect(mockAxiosGet).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('getMLBBettingOdds null date returns null without axios', async () => {
|
||||
expect(await adapter.getMLBBettingOdds(null)).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user