Skip to content

Commit

Permalink
fix; useRealTimers when finishing each test
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbertt committed Dec 8, 2023
1 parent bacd12e commit 90101bb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/ic-websocket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe("IcWebsocket class", () => {
});

afterEach(() => {
jest.useRealTimers();
mockWsServer.close();
});

Expand Down Expand Up @@ -228,8 +229,6 @@ describe("IcWebsocket class", () => {

expect(onClose).toHaveBeenCalled();
expect(icWs.readyState).toEqual(WebSocket.CLOSED);

jest.useRealTimers();
});

it("creates a new instance and sends the open message", async () => {
Expand Down Expand Up @@ -299,8 +298,6 @@ describe("IcWebsocket class", () => {
expect(icWs.readyState).toEqual(WebSocket.OPEN);
// make sure onmessage callback is not called when receiving the first message
expect(onMessage).not.toHaveBeenCalled();

jest.useRealTimers();
});

it("onmessage is called when a valid message is received", async () => {
Expand Down

0 comments on commit 90101bb

Please sign in to comment.