Skip to content

Commit 9fc1e66

Browse files
committed
test(utils): fix flaky test
1 parent 4ffa0ef commit 9fc1e66

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/utils/get-superuser-token.e2e-spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,14 @@ describe("getSuperuserToken", () => {
5757
vi.useFakeTimers({
5858
toFake: ["setTimeout"]
5959
});
60-
vi.spyOn(global, "fetch").mockResolvedValueOnce(
61-
new Response(undefined, { status: 429 })
62-
);
60+
vi.spyOn(global, "fetch")
61+
.mockResolvedValueOnce(new Response(undefined, { status: 429 }))
62+
.mockResolvedValueOnce(
63+
new Response(JSON.stringify({ token: "test-token" }), {
64+
status: 200,
65+
headers: { "Content-Type": "application/json" }
66+
})
67+
);
6368

6469
const promise = getSuperuserToken(
6570
options.url,

0 commit comments

Comments
 (0)