From 1f006dbc5f458211d0250fc60138d3d69985cf22 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 30 Apr 2026 02:58:34 +0100 Subject: [PATCH] test(core): stabilize changed gate mocks --- src/agents/model-auth-env.ts | 5 ++++- src/agents/models-config.providers.moonshot.test.ts | 1 + src/agents/models-config.providers.nvidia.test.ts | 1 + src/agents/models-config.runtime-source-snapshot.test.ts | 1 + ...nfig.uses-first-github-copilot-profile-env-tokens.test.ts | 1 + src/flows/provider-flow.test.ts | 4 ++++ 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/agents/model-auth-env.ts b/src/agents/model-auth-env.ts index 19a5baf2285..30f8cdb6adb 100644 --- a/src/agents/model-auth-env.ts +++ b/src/agents/model-auth-env.ts @@ -132,7 +132,10 @@ export function resolveEnvApiKey( } } - const authEvidence = resolveAuthEvidence(authEvidenceMap[normalized], env); + const evidence = Object.hasOwn(authEvidenceMap, normalized) + ? authEvidenceMap[normalized] + : undefined; + const authEvidence = resolveAuthEvidence(evidence, env); if (authEvidence) { return authEvidence; } diff --git a/src/agents/models-config.providers.moonshot.test.ts b/src/agents/models-config.providers.moonshot.test.ts index ef0ad67146a..389a2554ae9 100644 --- a/src/agents/models-config.providers.moonshot.test.ts +++ b/src/agents/models-config.providers.moonshot.test.ts @@ -24,6 +24,7 @@ vi.mock("./model-auth-env-vars.js", () => { PROVIDER_ENV_API_KEY_CANDIDATES: candidates, listKnownProviderEnvApiKeyNames: () => [...new Set(Object.values(candidates).flat())], resolveProviderEnvApiKeyCandidates: () => candidates, + resolveProviderEnvAuthEvidence: () => ({}), }; }); diff --git a/src/agents/models-config.providers.nvidia.test.ts b/src/agents/models-config.providers.nvidia.test.ts index b0f795ab48f..f0691d34899 100644 --- a/src/agents/models-config.providers.nvidia.test.ts +++ b/src/agents/models-config.providers.nvidia.test.ts @@ -30,6 +30,7 @@ vi.mock("./model-auth-env-vars.js", () => { PROVIDER_ENV_API_KEY_CANDIDATES: candidates, listKnownProviderEnvApiKeyNames: () => [...new Set(Object.values(candidates).flat())], resolveProviderEnvApiKeyCandidates: () => candidates, + resolveProviderEnvAuthEvidence: () => ({}), }; }); diff --git a/src/agents/models-config.runtime-source-snapshot.test.ts b/src/agents/models-config.runtime-source-snapshot.test.ts index 51da30ffc5c..ca6feb8546d 100644 --- a/src/agents/models-config.runtime-source-snapshot.test.ts +++ b/src/agents/models-config.runtime-source-snapshot.test.ts @@ -18,6 +18,7 @@ vi.mock("./model-auth-env-vars.js", () => ({ listKnownProviderEnvApiKeyNames: () => ["OPENAI_API_KEY"], PROVIDER_ENV_API_KEY_CANDIDATES: { openai: ["OPENAI_API_KEY"] }, resolveProviderEnvApiKeyCandidates: () => ({ openai: ["OPENAI_API_KEY"] }), + resolveProviderEnvAuthEvidence: () => ({}), })); vi.mock("../plugins/provider-runtime.js", () => ({ diff --git a/src/agents/models-config.uses-first-github-copilot-profile-env-tokens.test.ts b/src/agents/models-config.uses-first-github-copilot-profile-env-tokens.test.ts index 0514fca6137..af792bfb8b6 100644 --- a/src/agents/models-config.uses-first-github-copilot-profile-env-tokens.test.ts +++ b/src/agents/models-config.uses-first-github-copilot-profile-env-tokens.test.ts @@ -20,6 +20,7 @@ vi.mock("./model-auth-env-vars.js", () => ({ PROVIDER_ENV_API_KEY_CANDIDATES: {}, listKnownProviderEnvApiKeyNames: () => [], resolveProviderEnvApiKeyCandidates: () => ({}), + resolveProviderEnvAuthEvidence: () => ({}), })); vi.mock("../plugins/provider-runtime.js", () => ({ diff --git a/src/flows/provider-flow.test.ts b/src/flows/provider-flow.test.ts index 9302677f6d5..389bd9deb4b 100644 --- a/src/flows/provider-flow.test.ts +++ b/src/flows/provider-flow.test.ts @@ -1,5 +1,9 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; +vi.hoisted(() => { + vi.resetModules(); +}); + type ResolveProviderInstallCatalogEntries = typeof import("../plugins/provider-install-catalog.js").resolveProviderInstallCatalogEntries; type ResolveManifestProviderAuthChoices =