Skip to content

Commit 67c822d

Browse files
committed
chore: add tests for connection lifecycle
1 parent b95a528 commit 67c822d

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

packages/sdk/tests/index.spec.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3527,13 +3527,15 @@ describe("restoreReplaneClient", () => {
35273527
it("should call onConnectionError when connection is lost and retrying", async () => {
35283528
const onConnectionError = vi.fn();
35293529
let callCount = 0;
3530-
const failOnSecondFetch = vi.fn().mockImplementation(async (url: string, init?: RequestInit) => {
3531-
callCount++;
3532-
if (callCount === 2) {
3533-
throw new Error("Connection lost");
3534-
}
3535-
return mockServer.fetchFn(url, init);
3536-
});
3530+
const failOnSecondFetch = vi
3531+
.fn()
3532+
.mockImplementation(async (url: string, init?: RequestInit) => {
3533+
callCount++;
3534+
if (callCount === 2) {
3535+
throw new Error("Connection lost");
3536+
}
3537+
return mockServer.fetchFn(url, init);
3538+
});
35373539

35383540
const snapshot: ReplaneSnapshot<Record<string, unknown>> = {
35393541
configs: [{ name: "config1", value: "snapshot-value", overrides: [] }],

0 commit comments

Comments
 (0)