Skip to content

Commit

Permalink
test: add test with onAnyOutgoing() and binary attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Jan 19, 2023
1 parent 6c27b8b commit 1298839
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions test/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,22 @@ describe("socket", () => {
});
});

it("should call listener when broadcasting binary data", (done) => {
const io = new Server(0);
const clientSocket = createClient(io, "/", { multiplex: false });

io.on("connection", (socket) => {
socket.onAnyOutgoing((event, arg1) => {
expect(event).to.be("my-event");
expect(arg1).to.be.an(Uint8Array);

success(done, io, clientSocket);
});

io.emit("my-event", Uint8Array.of(1, 2, 3));
});
});

it("should prepend listener", (done) => {
const io = new Server(0);
const clientSocket = createClient(io, "/", { multiplex: false });
Expand Down

0 comments on commit 1298839

Please sign in to comment.