Transports and testing

Run live, record fixtures, replay them offline, and prove the UI follows the judgment.

JEV_TRANSPORT decides how judgments are answered. The default is live when a key is present and replay when one is not, so a checkout with no key still runs.

valuebehaviour
liveOne API call per batch.
recordLive, then writes one fixture per decision.
replayFixtures only. Throws on a miss rather than going live.
mockDeterministic synthetic answers. No key, no network.
autoLive, falling back to fixtures when the call fails.

Testing without spending anything

  • Unit tests use the mock transport: no key, no network, fully deterministic.
  • End-to-end tests run the app under replay, with the API key absent from that environment — the absence is what proves replay is really serving the judgments.
  • A live contract test can be skipped when no key is present, so CI stays green either way.

The test that actually matters

Edit a recorded answer on disk, reload, and assert the UI changed. Without that test, a component permanently rendering its fallback is indistinguishable from a working one.

// change the recorded choice from "line" to "stat"
record.answer = { type: 'choice', choice: 'stat', probabilities: { … }, confidence: 0.85 };
writeFileSync(fixturePath, JSON.stringify(record, null, 2));

await page.reload();
await expect(page.getByTestId('view-stat')).toBeVisible();