repositories / pi-ext
pi-ext
bugabingas pi extensions
owned by bugabinga
extensions/model-info/__tests__/harness.test.ts
RawFile outline
import { afterEach, describe, expect, it } from "bun:test";
import path from "node:path";
import {
createTestSession,
type TestSession,
} from "@marcfargas/pi-test-harness";
import { __test } from "../index.ts";
describe("model-info pi-test-harness", () => {
let t: TestSession | undefined;
afterEach(() => {
t?.dispose();
t = undefined;
});
it("loads in real Pi extension runtime", async () => {
const extensionPath = path.resolve(import.meta.dir, "../index.ts");
t = await createTestSession({ extensions: [extensionPath] });
expect(t.session.extensionRunner.extensions).toHaveLength(1);
expect(t.session.extensionRunner.extensions[0].path).toBe(extensionPath);
});
it("formats model and thinking", () => {
const ctx = {
cwd: "/tmp",
model: { provider: "test", id: "openai-codex/gpt-5.5" },
sessionManager: {
getBranch: () => [
{ type: "thinking_level_change", thinkingLevel: "high" },
],
},
} as any;
expect(__test.modelInfoLabel(ctx)).toBe("gpt-5.5:high");
expect(__test.enabledSetting({ enable: true })).toBe(true);
});
});