// Ported from apps/server/test (CR-014 Step 14.5): now runs on the engine. import { describe, expect, it, vi } from "vitest"; import { useTestApp, signUp, getState, flyTutorialRun } from "../support"; // The deal after three runs instead of five: the loaner is then at the Moon. vi.mock("@deadhead/content", async (importOriginal) => { const original = await importOriginal(); return { ...original, content: { ...original.content, config: { ...original.content.config, tutorialRunsBeforeDeal: 3 }, }, }; }); const testApp = useTestApp(); describe("deal availability with tutorialRunsBeforeDeal = 3", () => { it("offers the deal after the third run, though the loaner is at the Moon (decision 0.5.108)", async () => { const guest = await signUp(testApp().app); for (let run = 1; run <= 2; run++) await flyTutorialRun(testApp(), guest); expect((await getState(testApp().app, guest)).tutorial).toMatchObject({ runsCompleted: 2, dealAvailable: false, }); const state = await flyTutorialRun(testApp(), guest); expect(state.tutorial).toMatchObject({ runsCompleted: 3, loanerLocationId: "moon", dealAvailable: true, }); }); });