Fix Claude model catalog CI assertion
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
||||||
import { execFileSync } from "node:child_process";
|
import { execFileSync } from "node:child_process";
|
||||||
|
|
||||||
|
import type { AgentModelDefinition } from "../agent-sdk-types.js";
|
||||||
import { createDaemonTestContext, type DaemonTestContext } from "../test-utils/index.js";
|
import { createDaemonTestContext, type DaemonTestContext } from "../test-utils/index.js";
|
||||||
|
|
||||||
function isBinaryInstalled(binary: string): boolean {
|
function isBinaryInstalled(binary: string): boolean {
|
||||||
@@ -15,6 +16,16 @@ function isBinaryInstalled(binary: string): boolean {
|
|||||||
const hasCodex = isBinaryInstalled("codex");
|
const hasCodex = isBinaryInstalled("codex");
|
||||||
const hasOpenCode = isBinaryInstalled("opencode");
|
const hasOpenCode = isBinaryInstalled("opencode");
|
||||||
|
|
||||||
|
function modelMatchesFamily(
|
||||||
|
model: AgentModelDefinition,
|
||||||
|
family: "sonnet" | "haiku",
|
||||||
|
): boolean {
|
||||||
|
const haystacks = [model.id, model.label, model.description ?? ""].map((value) =>
|
||||||
|
value.toLowerCase(),
|
||||||
|
);
|
||||||
|
return haystacks.some((text) => text.includes(family));
|
||||||
|
}
|
||||||
|
|
||||||
describe("provider model catalogs (e2e)", () => {
|
describe("provider model catalogs (e2e)", () => {
|
||||||
let ctx: DaemonTestContext;
|
let ctx: DaemonTestContext;
|
||||||
|
|
||||||
@@ -32,11 +43,8 @@ describe("provider model catalogs (e2e)", () => {
|
|||||||
expect(result.error).toBeNull();
|
expect(result.error).toBeNull();
|
||||||
expect(result.models.length).toBeGreaterThan(0);
|
expect(result.models.length).toBeGreaterThan(0);
|
||||||
|
|
||||||
const descriptions = result.models.map((model) =>
|
expect(result.models.some((model) => modelMatchesFamily(model, "sonnet"))).toBe(true);
|
||||||
`${model.label} ${model.description ?? ""}`.toLowerCase(),
|
expect(result.models.some((model) => modelMatchesFamily(model, "haiku"))).toBe(true);
|
||||||
);
|
|
||||||
expect(descriptions.some((text) => text.includes("sonnet 4.5"))).toBe(true);
|
|
||||||
expect(descriptions.some((text) => text.includes("haiku"))).toBe(true);
|
|
||||||
}, 180_000);
|
}, 180_000);
|
||||||
|
|
||||||
test.runIf(hasCodex)(
|
test.runIf(hasCodex)(
|
||||||
|
|||||||
Reference in New Issue
Block a user