jest-websocket-mock icon indicating copy to clipboard operation
jest-websocket-mock copied to clipboard

Mock websockets and assert complex websocket interactions with Jest

Results 17 jest-websocket-mock issues
Sort by recently updated
recently updated
newest added

That version fixes https://github.com/thoov/mock-socket/issues/384. See #165.

Fixes #51 Finally got around to this. This is what I'm thinking of for the new `toReceiveMessage` matcher, as we discussed before. Here are some example failure messages: ### Wrong...

I am running the following test in NodeJS. ```javascript import WS from 'jest-websocket-mock'; import WebSocket from 'ws'; test('example test with jest-websocket-mock', async () => { const server = new WS('ws://localhost:1234');...

I can see that the library supports close and error, one of which gracefully shuts down the connection, and the other which sends an error message; but I want to...

Hi! I'm trying to write some tests against a server that already exists (currently locally). NodeJS: v21.7.3 NPM: 10.8.0 I tried following this guide in the README: https://github.com/romgain/jest-websocket-mock?tab=readme-ov-file#using-jest-websocket-mock-to-interact-with-a-non-global-websocket-object It fails...

Hi folks, I've following tests: Jest Test Code ```ts import WS from "jest-websocket-mock"; import { act, cleanup, renderHook } from "@testing-library/react"; import { z } from "zod"; import useLiveDbHook from...

Whenever I am trying to connect the mocked server with the client , using the `await server.connected` , in the beforeAll block , at that point I am facing the...