fix(coding-agent): use current Copilot model in registry test

This commit is contained in:
David Brailovsky 2026-09-04 11:19:20 +02:00
parent ef41a24b39
commit 744a94d7d4

View file

@ -8,7 +8,7 @@ import type {
Model,
OpenAICompletionsCompat,
} from "@earendil-works/pi-ai/compat";
import { getApiProvider, getSupportedThinkingLevels } from "@earendil-works/pi-ai/compat";
import { getApiProvider, getModels, getSupportedThinkingLevels } from "@earendil-works/pi-ai/compat";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { AuthStorage } from "../src/core/auth-storage.ts";
import type { ModelsJsonProvider } from "../src/core/model-config.ts";
@ -1879,12 +1879,15 @@ describe("ModelRegistry", () => {
});
test("getAvailable filters GitHub Copilot OAuth models to account picker availability", async () => {
const copilotModel = getModels("github-copilot")[0];
if (!copilotModel) throw new Error("Expected at least one GitHub Copilot model");
await authStorage.modify("github-copilot", async () => ({
type: "oauth",
refresh: "github-access-token",
access: "tid=test;exp=9999999999;proxy-ep=proxy.individual.githubcopilot.com;",
expires: Date.now() + 60_000,
availableModelIds: ["gpt-4.1"],
availableModelIds: [copilotModel.id],
}));
const registry = await createModelRegistry(authStorage, modelsJsonPath);
@ -1894,7 +1897,7 @@ describe("ModelRegistry", () => {
.getAvailable()
.filter((m) => m.provider === "github-copilot")
.map((m) => m.id),
).toEqual(["gpt-4.1"]);
).toEqual([copilotModel.id]);
});
test("getApiKeyAndHeaders resolves authHeader on every request", async () => {