repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

extensions/model-info/__tests__/harness.test.ts

Raw
File outline
import { afterEach, describe, expect, it } from "vitest";
import { createTestSession, type TestSession } from "../../../test/harness";
import modelInfoExtension, { __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 () => {
		t = await createTestSession({ extensionFactories: [modelInfoExtension] });

		expect(t.session.extensionRunner.extensions).toHaveLength(1);
	});

	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");
	});
});