























@@ -47,19 +47,25 @@ function expectSingleProfileCredential(
4747profiles: ReturnType<typeof resolveExternalCliAuthProfiles>,
4848profileId: string,
4949) {
50-expect(profiles).toHaveLength(1);
51-expect(profiles[0]?.profileId).toBe(profileId);
52-expect(profiles[0]?.credential).toBeTruthy();
50+expect(profiles).toStrictEqual([
51+expect.objectContaining({
52+credential: expect.any(Object),
53+ profileId,
54+}),
55+]);
5356return profiles[0]?.credential as Record<string, unknown>;
5457}
55585659function expectSingleProfile(
5760profiles: ReturnType<typeof resolveExternalCliAuthProfiles>,
5861profileId: string,
5962) {
60-expect(profiles).toHaveLength(1);
61-expect(profiles[0]?.profileId).toBe(profileId);
62-expect(profiles[0]?.credential).toBeTruthy();
63+expect(profiles).toStrictEqual([
64+expect.objectContaining({
65+credential: expect.any(Object),
66+ profileId,
67+}),
68+]);
6369return profiles[0];
6470}
6571@@ -74,13 +80,13 @@ function expectCredentialFields(
7480}
75817682function expectReaderPolicyCall(mock: { mock: { calls: unknown[][] } }) {
77-expect(mock.mock.calls).toHaveLength(1);
78-const [arg] = mock.mock.calls[0] ?? [];
79-expect(arg).toBeTruthy();
80-if (!arg || typeof arg !== "object") {
81-throw new Error("Expected CLI reader options");
82-}
83-expect((arg as { allowKeychainPrompt?: unknown }).allowKeychainPrompt).toBe(false);
83+expect(mock.mock.calls).toStrictEqual([
84+ [
85+ expect.objectContaining({
86+ allowKeychainPrompt: false,
87+ }),
88+ ],
89+]);
8490}
85918692describe("external cli oauth resolution", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。