




















@@ -210,6 +210,18 @@ function makeRuntime(): RuntimeEnv {
210210};
211211}
212212213+function promptModelAllowlistOptions(index = 0) {
214+return mocks.promptModelAllowlist.mock.calls.at(index)?.at(0) as
215+| {
216+allowedKeys?: string[];
217+initialSelections?: string[];
218+loadCatalog?: boolean;
219+message?: string;
220+preferredProvider?: string;
221+}
222+| undefined;
223+}
224+213225const noopPrompter = {} as WizardPrompter;
214226215227function createKilocodeProvider() {
@@ -431,7 +443,7 @@ describe("promptAuthConfig", () => {
431443await promptAuthConfig({}, makeRuntime(), noopPrompter);
432444433445expect(mocks.promptModelAllowlist).toHaveBeenCalledOnce();
434-expect(mocks.promptModelAllowlist.mock.calls[0]?.[0]?.preferredProvider).toBe("openai");
446+expect(promptModelAllowlistOptions()?.preferredProvider).toBe("openai");
435447});
436448437449it("keeps the selected provider scope when existing config has another provider", async () => {
@@ -461,7 +473,7 @@ describe("promptAuthConfig", () => {
461473await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter);
462474463475expect(mocks.promptModelAllowlist).toHaveBeenCalledOnce();
464-expect(mocks.promptModelAllowlist.mock.calls[0]?.[0]?.preferredProvider).toBe("github-copilot");
476+expect(promptModelAllowlistOptions()?.preferredProvider).toBe("github-copilot");
465477});
466478467479it("loads the selected provider catalog after auth enables that plugin", async () => {
@@ -504,8 +516,8 @@ describe("promptAuthConfig", () => {
504516505517await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter);
506518507-expect(mocks.promptModelAllowlist.mock.calls[0]?.[0]?.preferredProvider).toBe("github-copilot");
508-expect(mocks.promptModelAllowlist.mock.calls[0]?.[0]?.loadCatalog).toBe(true);
519+expect(promptModelAllowlistOptions()?.preferredProvider).toBe("github-copilot");
520+expect(promptModelAllowlistOptions()?.loadCatalog).toBe(true);
509521});
510522511523it("loads configured provider models after Ollama Cloud + Local and Cloud only setup", async () => {
@@ -534,7 +546,7 @@ describe("promptAuthConfig", () => {
534546await promptAuthConfig({}, makeRuntime(), noopPrompter);
535547536548expect(mocks.promptModelAllowlist).toHaveBeenCalledOnce();
537-const allowlistOptions = mocks.promptModelAllowlist.mock.calls[0]?.[0];
549+const allowlistOptions = promptModelAllowlistOptions();
538550expect(allowlistOptions?.preferredProvider).toBe("ollama");
539551expect(allowlistOptions?.loadCatalog).toBe(true);
540552});
@@ -575,7 +587,7 @@ describe("promptAuthConfig", () => {
575587await promptAuthConfig({}, makeRuntime(), noopPrompter);
576588577589expect(mocks.promptModelAllowlist).toHaveBeenCalledOnce();
578-const allowlistOptions = mocks.promptModelAllowlist.mock.calls[0]?.[0];
590+const allowlistOptions = promptModelAllowlistOptions();
579591expect(allowlistOptions?.preferredProvider).toBe("github-copilot");
580592expect(allowlistOptions?.loadCatalog).toBe(true);
581593});
@@ -614,7 +626,7 @@ describe("promptAuthConfig", () => {
614626615627await promptAuthConfig({}, makeRuntime(), noopPrompter);
616628617-const call = mocks.promptModelAllowlist.mock.calls[0]?.[0];
629+const call = promptModelAllowlistOptions();
618630expect(call?.preferredProvider).toBe("github-copilot");
619631expect(call?.loadCatalog).toBe(true);
620632});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。