// @ts-ignore vitest is provided by the backend test runner. import { describe, expect, it } from "vitest"; import { PILOT_FAST_MODEL_ID, PILOT_PRO_MODEL_ID, normalizeModelForAccess, } from "./modelAccess"; describe("model access policy", () => { it("keeps a selectable internal model for operators", () => { expect( normalizeModelForAccess("gemini-3-flash-agent-high", true), ).toBe("gemini-3-flash-agent-high"); }); it("falls back to Fast for forbidden non-operator models", () => { expect( normalizeModelForAccess("gemini-3-flash-agent-high", false), ).toBe(PILOT_FAST_MODEL_ID); }); it("lets non-operators select Pro", () => { expect(normalizeModelForAccess(PILOT_PRO_MODEL_ID, false)).toBe( PILOT_PRO_MODEL_ID, ); }); it("uses Fast for missing or invalid non-operator requests", () => { expect(normalizeModelForAccess(undefined, false)).toBe( PILOT_FAST_MODEL_ID, ); expect(normalizeModelForAccess("not-a-model", false)).toBe( PILOT_FAST_MODEL_ID, ); }); });