From 06fe67d7192a3b67f22ad7a8cf11a0e89758c1b2 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 26 Apr 2026 11:41:08 +0100 Subject: [PATCH] test: type setup provider mocks (cherry picked from commit ea9da71f031679b23cb17468f00219c870685ff5) --- .../auth-choice.apply.plugin-provider.test.ts | 10 ++++++++-- src/wizard/setup.test.ts | 12 ++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/commands/auth-choice.apply.plugin-provider.test.ts b/src/commands/auth-choice.apply.plugin-provider.test.ts index 963b0dbd3a3..5082fff2237 100644 --- a/src/commands/auth-choice.apply.plugin-provider.test.ts +++ b/src/commands/auth-choice.apply.plugin-provider.test.ts @@ -12,10 +12,14 @@ type ResolveProviderInstallCatalogEntry = typeof import("../plugins/provider-install-catalog.js").resolveProviderInstallCatalogEntry; type EnsureOnboardingPluginInstalled = typeof import("../commands/onboarding-plugin-install.js").ensureOnboardingPluginInstalled; +type ResolveManifestProviderAuthChoice = + typeof import("../plugins/provider-auth-choices.js").resolveManifestProviderAuthChoice; +type ResolvePluginSetupProvider = + typeof import("../plugins/provider-auth-choice.runtime.js").resolvePluginSetupProvider; const resolvePluginProviders = vi.hoisted(() => vi.fn<() => ProviderPlugin[]>(() => [])); const resolvePluginSetupProvider = vi.hoisted(() => - vi.fn<() => ProviderPlugin | undefined>(() => undefined), + vi.fn(() => undefined), ); const resolveProviderPluginChoice = vi.hoisted(() => vi.fn<() => { provider: ProviderPlugin; method: ProviderAuthMethod } | null>(), @@ -28,7 +32,9 @@ vi.mock("../plugins/provider-auth-choice.runtime.js", () => ({ runProviderModelSelectedHook, })); -const resolveManifestProviderAuthChoice = vi.hoisted(() => vi.fn(() => undefined)); +const resolveManifestProviderAuthChoice = vi.hoisted(() => + vi.fn(() => undefined), +); vi.mock("../plugins/provider-auth-choices.js", () => ({ resolveManifestProviderAuthChoice, })); diff --git a/src/wizard/setup.test.ts b/src/wizard/setup.test.ts index bb0f08c6829..65b9c58c26f 100644 --- a/src/wizard/setup.test.ts +++ b/src/wizard/setup.test.ts @@ -14,6 +14,10 @@ type ResolveProviderPluginChoice = typeof import("../plugins/provider-auth-choice.runtime.js").resolveProviderPluginChoice; type ResolvePluginProvidersRuntime = typeof import("../plugins/provider-auth-choice.runtime.js").resolvePluginProviders; +type ResolvePluginSetupProvider = + typeof import("../plugins/provider-auth-choice.runtime.js").resolvePluginSetupProvider; +type ResolveManifestProviderAuthChoice = + typeof import("../plugins/provider-auth-choices.js").resolveManifestProviderAuthChoice; type PromptDefaultModel = typeof import("../commands/model-picker.js").promptDefaultModel; type ApplyAuthChoice = typeof import("../commands/auth-choice.js").applyAuthChoice; @@ -23,8 +27,12 @@ const applyAuthChoice = vi.hoisted(() => vi.fn(async (args) => ({ config: args.config })), ); const resolvePreferredProviderForAuthChoice = vi.hoisted(() => vi.fn(async () => "demo-provider")); -const resolveManifestProviderAuthChoice = vi.hoisted(() => vi.fn(() => undefined)); -const resolvePluginSetupProvider = vi.hoisted(() => vi.fn(() => undefined)); +const resolveManifestProviderAuthChoice = vi.hoisted(() => + vi.fn(() => undefined), +); +const resolvePluginSetupProvider = vi.hoisted(() => + vi.fn(() => undefined), +); const resolveProviderPluginChoice = vi.hoisted(() => vi.fn(() => null), );