fix(test): hermetically exercise auth workflows
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { expect, test } from "vitest";
|
||||
import { expect, test, vi } from "vitest";
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
@@ -35,6 +35,20 @@ test("loads exact global enabledModels in configured order", () => {
|
||||
} finally { rmSync(f.root, { recursive: true, force: true }); }
|
||||
});
|
||||
|
||||
test("uses the configured Pi agent directory when no explicit directory is passed", () => {
|
||||
const f = fixture({ enabledModels: ["zai/glm-5.2"] });
|
||||
vi.stubEnv("PI_CODING_AGENT_DIR", f.agentDir);
|
||||
try {
|
||||
expect(loadPiEnabledModels({ harnessDir: f.harnessDir })).toMatchObject({
|
||||
ids: ["zai/glm-5.2"],
|
||||
warnings: [],
|
||||
});
|
||||
} finally {
|
||||
vi.unstubAllEnvs();
|
||||
rmSync(f.root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("project enabledModels overrides global enabledModels", () => {
|
||||
const f = fixture(
|
||||
{ enabledModels: ["zai/glm-5.2", "zai/glm-5v-turbo"] },
|
||||
|
||||
Reference in New Issue
Block a user