jest-websocket-mock
jest-websocket-mock copied to clipboard
Getting The Aggregator-Error on connecting server with client
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 Aggregator Error . I followed the exact readme https://www.npmjs.com/package/jest-websocket-mock?activeTab=readme , is there any problem the package it facing ?
My Test Case looks like this :
import WS from 'jest-websocket-mock';
import WebSocket from 'ws';
describe("WebSocket server", () => {
let server, client;
beforeEach(async () => {
server = new WS("ws://localhost:1234");
client = new WebSocket("ws://localhost:1234");
await server.connected;
});
afterEach(() => {
WS.clean();
});
it("should connect the client to the server successfully", async () => {
client.send("hello");
await expect(server).toReceiveMessage("hello");
expect(server).toHaveReceivedMessages(["hello"]);
});
});
The Error Looks like :