// npm run fixture: build, then serve the app and the fixture API on 127.0.0.1:4192.
// FIXTURE_ALWAYS_OPEN=1 lets Yasmar ring at any hour (for demos outside clinic hours).
// FIXTURE_SPEED=4 plays calls four times faster. FIXTURE_NO_SSE=1 forces polling.
import { fileURLToPath } from "node:url";
import { createFixtureServer } from "./server";
const port = Number(process.env.FIXTURE_PORT) || 4192;
const options = {
alwaysOpen: process.env.FIXTURE_ALWAYS_OPEN === "1" || process.argv.includes("--any-time"),
speed: Math.max(0.25, Number(process.env.FIXTURE_SPEED) || 1),
noSse: process.env.FIXTURE_NO_SSE === "1",
};
const dist = process.env.FIXTURE_DIST ?? fileURLToPath(new URL("../dist", import.meta.url));
const { server } = createFixtureServer(options, dist);
server.listen(port, "127.0.0.1", () =>
console.log(
`MARMAR Context fixture on http://127.0.0.1:${port} (fictional data${options.alwaysOpen ? ", rings at any hour" : ""}${options.noSse ? ", polling only" : ""}). Sign in as emeka.okafor@example.test; codes are in test/fixture/data.ts.`,
),
);