From 9f3292525bc540f5882c5d863041a00fa5ff5cd2 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Mon, 30 Jan 2023 08:26:56 +0100 Subject: [PATCH] test: add test with onAnyOutgoing() and binary attachments --- package-lock.json | 12 ++++++------ test/socket.ts | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 89238c49..36b09d68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11124,9 +11124,9 @@ } }, "node_modules/socket.io-parser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.1.tgz", - "integrity": "sha512-V4GrkLy+HeF1F/en3SpUaM+7XxYXpuMUWLGde1kSSh5nQMN4hLrbPIkD+otwh6q9R6NOQBN4AMaOZ2zVjui82g==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz", + "integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==", "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1" @@ -21614,9 +21614,9 @@ } }, "socket.io-parser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.1.tgz", - "integrity": "sha512-V4GrkLy+HeF1F/en3SpUaM+7XxYXpuMUWLGde1kSSh5nQMN4hLrbPIkD+otwh6q9R6NOQBN4AMaOZ2zVjui82g==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz", + "integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==", "requires": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1" diff --git a/test/socket.ts b/test/socket.ts index 13dc1dec..e4c3566e 100644 --- a/test/socket.ts +++ b/test/socket.ts @@ -470,6 +470,25 @@ describe("socket", () => { }); }); + it("should call listener with binary data", () => { + return wrap((done) => { + const socket = io(BASE_URL + "/abc", { + forceNew: true, + }); + + socket.on("connect", () => { + socket.onAnyOutgoing((event, arg1) => { + expect(event).to.be("my-event"); + expect(arg1).to.be.an(Uint8Array); + + success(done, socket); + }); + + socket.emit("my-event", Uint8Array.of(1, 2, 3)); + }); + }); + }); + it("should prepend listener", () => { return wrap((done) => { const socket = io(BASE_URL + "/abc", {