

























@@ -47,6 +47,14 @@ async function withTempHome<T>(fn: (homeDir: string) => Promise<T>): Promise<T>
4747}
4848}
494950+function providerCalls(mockFn: { mock: { calls: unknown[][] } }): unknown[] {
51+return mockFn.mock.calls.map(([params]) =>
52+params && typeof params === "object" && "provider" in params
53+ ? (params as { provider?: unknown }).provider
54+ : undefined,
55+);
56+}
57+5058describe("resolveProviderAuths plugin boundary", () => {
5159beforeAll(async () => {
5260({ resolveProviderAuths } = await import("./provider-usage.auth.js"));
@@ -126,11 +134,7 @@ describe("resolveProviderAuths plugin boundary", () => {
126134]);
127135});
128136129-expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledWith(
130-expect.objectContaining({
131-provider: "zai",
132-}),
133-);
137+expect(providerCalls(resolveProviderUsageAuthWithPluginMock)).toEqual(["zai"]);
134138expect(ensureAuthProfileStoreMock).not.toHaveBeenCalled();
135139});
136140@@ -160,11 +164,7 @@ describe("resolveProviderAuths plugin boundary", () => {
160164});
161165162166expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledTimes(1);
163-expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledWith(
164-expect.objectContaining({
165-provider: "zai",
166-}),
167-);
167+expect(providerCalls(resolveProviderUsageAuthWithPluginMock)).toEqual(["zai"]);
168168});
169169170170it("keeps auth-profile credential sources provider-specific", async () => {
@@ -205,11 +205,7 @@ describe("resolveProviderAuths plugin boundary", () => {
205205});
206206207207expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledTimes(1);
208-expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledWith(
209-expect.objectContaining({
210-provider: "anthropic",
211-}),
212-);
208+expect(providerCalls(resolveProviderUsageAuthWithPluginMock)).toEqual(["anthropic"]);
213209expect(ensureAuthProfileStoreMock).not.toHaveBeenCalled();
214210});
215211@@ -250,16 +246,8 @@ describe("resolveProviderAuths plugin boundary", () => {
250246]);
251247});
252248253-expect(resolveAuthProfileOrderMock).toHaveBeenCalledWith(
254-expect.objectContaining({
255-provider: "minimax-portal",
256-}),
257-);
258-expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledWith(
259-expect.objectContaining({
260-provider: "minimax",
261-}),
262-);
249+expect(providerCalls(resolveAuthProfileOrderMock)).toEqual(["minimax", "minimax-portal"]);
250+expect(providerCalls(resolveProviderUsageAuthWithPluginMock)).toEqual(["minimax"]);
263251expect(ensureAuthProfileStoreMock).not.toHaveBeenCalled();
264252});
265253@@ -286,11 +274,7 @@ describe("resolveProviderAuths plugin boundary", () => {
286274]);
287275});
288276289-expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledWith(
290-expect.objectContaining({
291-provider: "minimax",
292-}),
293-);
277+expect(providerCalls(resolveProviderUsageAuthWithPluginMock)).toEqual(["minimax"]);
294278expect(ensureAuthProfileStoreMock).not.toHaveBeenCalled();
295279});
296280@@ -332,10 +316,6 @@ describe("resolveProviderAuths plugin boundary", () => {
332316});
333317334318expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledTimes(1);
335-expect(resolveProviderUsageAuthWithPluginMock).toHaveBeenCalledWith(
336-expect.objectContaining({
337-provider: "anthropic",
338-}),
339-);
319+expect(providerCalls(resolveProviderUsageAuthWithPluginMock)).toEqual(["anthropic"]);
340320});
341321});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。