Files
dev/third_party/pi/packages/evals/test/pi-harness.test.ts
alexion 4def357d09 chore(vendor): import pi 0.85.1
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree.

git-subtree-dir: third_party/pi

git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
2026-09-14 10:48:47 -04:00

35 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { resolveModelSelection } from "../src/pi-harness.ts";
describe("resolveModelSelection", () => {
it("prefers an explicit harness model over environment defaults", () => {
expect(
resolveModelSelection(
{ provider: "anthropic", id: "claude-opus-4-6" },
{ PI_PROVIDER: "openai-codex", PI_MODEL: "gpt-5.6-sol" },
),
).toEqual({ provider: "anthropic", id: "claude-opus-4-6" });
});
it("uses trimmed environment defaults when the harness has no explicit model", () => {
expect(resolveModelSelection(undefined, { PI_PROVIDER: " openai-codex ", PI_MODEL: " gpt-5.6-sol " })).toEqual({
provider: "openai-codex",
id: "gpt-5.6-sol",
});
});
it.each([
[undefined, {}],
[undefined, { PI_PROVIDER: "openai-codex" }],
[undefined, { PI_MODEL: "gpt-5.6-sol" }],
[
{ provider: "", id: "gpt-5.6-sol" },
{ PI_PROVIDER: "openai-codex", PI_MODEL: "gpt-5.6-sol" },
],
] as const)("rejects an incomplete model selection", (explicitModel, environment) => {
expect(() => resolveModelSelection(explicitModel, environment)).toThrow(
"Select a harness model explicitly or set both PI_PROVIDER and PI_MODEL as defaults.",
);
});
});