socket.io-protocol icon indicating copy to clipboard operation
socket.io-protocol copied to clipboard

Socket.io v4 test-suite

Open Totodore opened this issue 2 years ago • 0 comments

Here is a PR to add a socket.io protocol v4 test suite.

Closes #30

The only thing I'm not sure is this test :

    it("should disallow connection to an unknown namespace", async () => {
      const socket = new WebSocket(
        `${WS_URL}/socket.io/?EIO=3&transport=websocket`
      );

      await waitFor(socket, "message"); // Engine.IO handshake
      await waitFor(socket, "message"); // Socket.IO / namespace handshake
      await waitFor(socket, "message"); // auth packet

      socket.send("40/random");

      const { data } = await waitFor(socket, "message");

      // Should I expect "Invalid namespace" or "{ "message": "Invalid namespace" }"
      expect(data).to.eql('44/random,Invalid namespace');
    });

Totodore avatar Oct 15 '23 13:10 Totodore