Skip to content

Commit 1298839

Browse files
test: add test with onAnyOutgoing() and binary attachments
Related: - #4374 - socketio/socket.io-parser@ae8dd88
1 parent 6c27b8b commit 1298839

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/socket.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,22 @@ describe("socket", () => {
10011001
});
10021002
});
10031003

1004+
it("should call listener when broadcasting binary data", (done) => {
1005+
const io = new Server(0);
1006+
const clientSocket = createClient(io, "/", { multiplex: false });
1007+
1008+
io.on("connection", (socket) => {
1009+
socket.onAnyOutgoing((event, arg1) => {
1010+
expect(event).to.be("my-event");
1011+
expect(arg1).to.be.an(Uint8Array);
1012+
1013+
success(done, io, clientSocket);
1014+
});
1015+
1016+
io.emit("my-event", Uint8Array.of(1, 2, 3));
1017+
});
1018+
});
1019+
10041020
it("should prepend listener", (done) => {
10051021
const io = new Server(0);
10061022
const clientSocket = createClient(io, "/", { multiplex: false });

0 commit comments

Comments
 (0)