Spaces:
Sleeping
Sleeping
Download backend/src/lib/modelAccess.test.ts from bardd/mike-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/bardd/mike-backend/resolve/main/backend/src/lib/modelAccess.test.ts
- Command line
-
hf download hf://spaces/bardd/mike-backend/backend/src/lib/modelAccess.test.ts
-
curl -L -o modelAccess.test.ts https://huggingface.co/spaces/bardd/mike-backend/resolve/main/backend/src/lib/modelAccess.test.ts
1.15 kB
| // @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, | |
| ); | |
| }); | |
| }); | |