
























@@ -318,13 +318,12 @@ describe("promptAuthConfig", () => {
318318319319await promptAuthConfig({}, makeRuntime(), noopPrompter);
320320321-expect(mocks.promptModelAllowlist).toHaveBeenCalledWith(
322-expect.objectContaining({
323-allowedKeys: ["anthropic/claude-sonnet-4-6"],
324-initialSelections: ["anthropic/claude-sonnet-4-6"],
325-message: "Anthropic OAuth models",
326-}),
327-);
321+const allowlistOptions = mocks.promptModelAllowlist.mock.calls
322+.map(([options]) => options)
323+.find((options) => options?.message === "Anthropic OAuth models");
324+expect(allowlistOptions?.allowedKeys).toStrictEqual(["anthropic/claude-sonnet-4-6"]);
325+expect(allowlistOptions?.initialSelections).toStrictEqual(["anthropic/claude-sonnet-4-6"]);
326+expect(allowlistOptions?.message).toBe("Anthropic OAuth models");
328327});
329328330329it("preserves existing model entries outside provider-scoped allowlist updates", async () => {
@@ -431,11 +430,8 @@ describe("promptAuthConfig", () => {
431430432431await promptAuthConfig({}, makeRuntime(), noopPrompter);
433432434-expect(mocks.promptModelAllowlist).toHaveBeenCalledWith(
435-expect.objectContaining({
436-preferredProvider: "openai",
437-}),
438-);
433+expect(mocks.promptModelAllowlist).toHaveBeenCalledOnce();
434+expect(mocks.promptModelAllowlist.mock.calls[0]?.[0]?.preferredProvider).toBe("openai");
439435});
440436441437it("keeps the selected provider scope when existing config has another provider", async () => {
@@ -464,11 +460,8 @@ describe("promptAuthConfig", () => {
464460465461await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter);
466462467-expect(mocks.promptModelAllowlist).toHaveBeenCalledWith(
468-expect.objectContaining({
469-preferredProvider: "github-copilot",
470-}),
471-);
463+expect(mocks.promptModelAllowlist).toHaveBeenCalledOnce();
464+expect(mocks.promptModelAllowlist.mock.calls[0]?.[0]?.preferredProvider).toBe("github-copilot");
472465});
473466474467it("loads the selected provider catalog after auth enables that plugin", async () => {
@@ -540,12 +533,10 @@ describe("promptAuthConfig", () => {
540533541534await promptAuthConfig({}, makeRuntime(), noopPrompter);
542535543-expect(mocks.promptModelAllowlist).toHaveBeenCalledWith(
544-expect.objectContaining({
545-preferredProvider: "ollama",
546-loadCatalog: true,
547-}),
548-);
536+expect(mocks.promptModelAllowlist).toHaveBeenCalledOnce();
537+const allowlistOptions = mocks.promptModelAllowlist.mock.calls[0]?.[0];
538+expect(allowlistOptions?.preferredProvider).toBe("ollama");
539+expect(allowlistOptions?.loadCatalog).toBe(true);
549540});
550541551542it("loads plugin catalog when the selected provider allowlist requires it", async () => {
@@ -583,12 +574,10 @@ describe("promptAuthConfig", () => {
583574584575await promptAuthConfig({}, makeRuntime(), noopPrompter);
585576586-expect(mocks.promptModelAllowlist).toHaveBeenCalledWith(
587-expect.objectContaining({
588-preferredProvider: "github-copilot",
589-loadCatalog: true,
590-}),
591-);
577+expect(mocks.promptModelAllowlist).toHaveBeenCalledOnce();
578+const allowlistOptions = mocks.promptModelAllowlist.mock.calls[0]?.[0];
579+expect(allowlistOptions?.preferredProvider).toBe("github-copilot");
580+expect(allowlistOptions?.loadCatalog).toBe(true);
592581});
593582594583it("loads catalog when the selected provider has manifest catalog rows", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。