From 3ac194f76759d2f3d21d6ff57e87824bf2fbe4dd Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza Date: Wed, 15 Jul 2026 06:44:13 -0300 Subject: [PATCH] test(providers): type the models discovery payload instead of any (#6976) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no-explicit-any is an error under tests/ (#6218), so the 4 `any` usages in the new discovery assertions failed the max-warnings-0 lint gate. Replace them with an explicit ModelsResponseBody shape — type-only change, all 13 assertions unchanged and still passing. --- .../unit/openrouter-embeddings-catalog-6976.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/unit/openrouter-embeddings-catalog-6976.test.ts b/tests/unit/openrouter-embeddings-catalog-6976.test.ts index 953e0ad565..f32d1d0612 100644 --- a/tests/unit/openrouter-embeddings-catalog-6976.test.ts +++ b/tests/unit/openrouter-embeddings-catalog-6976.test.ts @@ -15,6 +15,10 @@ const staticModels = await import("../../src/lib/providers/staticModels.ts"); const originalFetch = globalThis.fetch; +/** Shape of the /api/providers/[id]/models discovery payload asserted below. */ +type DiscoveredModel = { id: string; name?: string }; +type ModelsResponseBody = { source: string; models: DiscoveredModel[] }; + async function resetStorage() { globalThis.fetch = originalFetch; core.resetDbInstance(); @@ -87,11 +91,11 @@ test("live discovery merges curated embeddings into the response even when /v1/m }); const response = await callRoute(connection.id); - const body = (await response.json()) as any; + const body = (await response.json()) as ModelsResponseBody; assert.equal(response.status, 200); assert.equal(body.source, "api"); - const ids = body.models.map((m: any) => m.id); + const ids = body.models.map((m) => m.id); // Chat model from the live /v1/models fetch is preserved. assert.ok(ids.includes("anthropic/claude-sonnet-5")); // RED before the Step 2 merge: the live discovery success path (buildApiDiscoveryResponse) @@ -115,9 +119,9 @@ test("live discovery dedups: a model already present in the live catalog is not }); const response = await callRoute(connection.id); - const body = (await response.json()) as any; + const body = (await response.json()) as ModelsResponseBody; - const bgeEntries = body.models.filter((m: any) => m.id === "baai/bge-m3"); + const bgeEntries = body.models.filter((m) => m.id === "baai/bge-m3"); assert.equal(bgeEntries.length, 1, "baai/bge-m3 must appear exactly once"); assert.equal(bgeEntries[0].name, "BGE-M3 (live)", "live entry wins over the curated duplicate"); });