import { fileURLToPath } from "node:url"; import { afterEach, describe, expect, it } from "vitest"; import { createPiSession, type PiSession, } from "../../../test/fixture/create-pi-session.ts"; import { _test } from "../index.ts"; let session: PiSession | undefined; afterEach(async () => { await session?.dispose(); session = undefined; }); function fastPath(): string { return fileURLToPath(new URL("../index.ts", import.meta.url)); } describe("fast contract", () => { it("loads through the owned fixture", async () => { const extensionPath = fastPath(); session = await createPiSession({ extensionPaths: [extensionPath] }); expect(session.errors).toEqual([]); expect(session.extensions).toHaveLength(1); expect(session.extensions[0]!.path).toBe(extensionPath); }); it("owns fast activation", () => { expect( _test.fastActive({ model: { provider: "openai-codex" } } as never, true), ).toBe(true); expect( _test.fastActive({ model: { provider: "openai" } } as never, true), ).toBe(false); expect( _test.fastActive({ model: { provider: "openai-codex" } } as never, false), ).toBe(false); }); });