@buzzr/dfs-engine-test-vectors

Golden fixtures that prove your @buzzr/dfs-engine integration grades identically to Buzzr's production pipeline. Each vector is an { entry, gameLogsByLegId, expected } triple — a real slip shape, the boxscore rows that settle it, and the exact settlement outcome — verified against the engine in this package's own test suite.
If you wire your own stat providers, persistence, or settlement orchestration around the engine, replaying these vectors in your CI turns "we think our wiring is right" into a passing conformance test.
Install
npm install --save-dev @buzzr/dfs-engine-test-vectors @buzzr/dfs-engine
30-second quick start
import { describe, expect, test } from 'vitest';
import { createDfsEngine, defineStatProvider } from '@buzzr/dfs-engine';
import { TEST_VECTORS } from '@buzzr/dfs-engine-test-vectors';
describe('my-integration conformance', () => {
test.each(TEST_VECTORS.map((v) => [v.name, v] as const))('%s', async (_name, v) => {
const provider = defineStatProvider({
id: 'mine',
getGameLog: ({ leg }) => v.gameLogsByLegId[leg.legId] ?? [],
});
const engine = createDfsEngine({ statProviders: [provider] });
const result = await engine.settleEntry(v.entry, { statProviderId: 'mine' });
expect(result.status).toBe(v.expected.status);
for (const expectedLeg of v.expected.legs) {
const leg = result.legs.find((l) => l.legId === expectedLeg.legId);
expect(leg?.status).toBe(expectedLeg.status);
expect(leg?.actual).toBe(expectedLeg.actual);
}
});
});
What's inside
prizepicks_power_2leg_all_win | PrizePicks Power, both NBA overs clear the line — settles won |
prizepicks_power_2leg_one_loss | All-or-nothing: one missed leg loses the whole Power entry |
underdog_standard_2leg_under_hits | Underdog Standard, both unders hit — settles won |
TEST_VECTORS | Readonly array of verified TestVector triples |
TestVector | Type: { name, description, entry, gameLogsByLegId, expected } |
ExpectedLegOutcome | Type: expected per-leg { legId, status, actual } |
When to use this vs siblings
Links
License
MIT