diff --git a/src/agents/auth-profiles.external-cli-sync.test.ts b/src/agents/auth-profiles.external-cli-sync.test.ts index 9b7775b1eac..46d236cb37e 100644 --- a/src/agents/auth-profiles.external-cli-sync.test.ts +++ b/src/agents/auth-profiles.external-cli-sync.test.ts @@ -47,9 +47,12 @@ function expectSingleProfileCredential( profiles: ReturnType, profileId: string, ) { - expect(profiles).toHaveLength(1); - expect(profiles[0]?.profileId).toBe(profileId); - expect(profiles[0]?.credential).toBeTruthy(); + expect(profiles).toStrictEqual([ + expect.objectContaining({ + credential: expect.any(Object), + profileId, + }), + ]); return profiles[0]?.credential as Record; } @@ -57,9 +60,12 @@ function expectSingleProfile( profiles: ReturnType, profileId: string, ) { - expect(profiles).toHaveLength(1); - expect(profiles[0]?.profileId).toBe(profileId); - expect(profiles[0]?.credential).toBeTruthy(); + expect(profiles).toStrictEqual([ + expect.objectContaining({ + credential: expect.any(Object), + profileId, + }), + ]); return profiles[0]; } @@ -74,13 +80,13 @@ function expectCredentialFields( } function expectReaderPolicyCall(mock: { mock: { calls: unknown[][] } }) { - expect(mock.mock.calls).toHaveLength(1); - const [arg] = mock.mock.calls[0] ?? []; - expect(arg).toBeTruthy(); - if (!arg || typeof arg !== "object") { - throw new Error("Expected CLI reader options"); - } - expect((arg as { allowKeychainPrompt?: unknown }).allowKeychainPrompt).toBe(false); + expect(mock.mock.calls).toStrictEqual([ + [ + expect.objectContaining({ + allowKeychainPrompt: false, + }), + ], + ]); } describe("external cli oauth resolution", () => {