Skip to content

Commit 8b1411e

Browse files
author
Peter Steinberger
committed
test(wizard): fixture model auth policy discovery
1 parent 1221816 commit 8b1411e

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎src/wizard/setup.model-auth.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,30 @@ import type { RuntimeEnv } from "../runtime.js";
55
import { WizardCancelledError, type WizardPrompter } from "./prompts.js";
66
import { runSetupModelAuthStep } from "./setup.model-auth.js";
77

8+
type ResolveManifestProviderAuthChoice =
9+
typeof import("../plugins/provider-auth-choices.js").resolveManifestProviderAuthChoice;
10+
type ResolvePluginSetupProvider =
11+
typeof import("../plugins/setup-registry.js").resolvePluginSetupProvider;
12+
813
const applyAuthChoice = vi.hoisted(() => vi.fn());
914
const warnIfModelConfigLooksOff = vi.hoisted(() => vi.fn());
1015
const resolvePreferredProviderForAuthChoice = vi.hoisted(() => vi.fn());
1116
const promptDefaultModel = vi.hoisted(() => vi.fn());
1217
const applyPrimaryModel = vi.hoisted(() => vi.fn((config: unknown) => config));
1318
const promptAuthChoiceGrouped = vi.hoisted(() => vi.fn());
1419
const ensureAuthProfileStore = vi.hoisted(() => vi.fn(() => ({ profiles: {} })));
20+
const resolveManifestProviderAuthChoice = vi.hoisted(() =>
21+
vi.fn<ResolveManifestProviderAuthChoice>(() => ({
22+
pluginId: "anthropic",
23+
providerId: "anthropic",
24+
methodId: "anthropic-cli",
25+
choiceId: "anthropic-cli",
26+
choiceLabel: "Anthropic CLI",
27+
})),
28+
);
29+
const resolvePluginSetupProvider = vi.hoisted(() =>
30+
vi.fn<ResolvePluginSetupProvider>(() => undefined),
31+
);
1532

1633
vi.mock("../commands/auth-choice.js", () => ({
1734
applyAuthChoice,
@@ -34,6 +51,14 @@ vi.mock("../agents/auth-profiles.runtime.js", () => ({
3451
ensureAuthProfileStore,
3552
}));
3653

54+
vi.mock("../plugins/provider-auth-choices.js", () => ({
55+
resolveManifestProviderAuthChoice,
56+
}));
57+
58+
vi.mock("../plugins/setup-registry.js", () => ({
59+
resolvePluginSetupProvider,
60+
}));
61+
3762
function createPrompter(): WizardPrompter {
3863
return {
3964
intro: vi.fn(),

0 commit comments

Comments
 (0)