mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
29 lines
583 B
JavaScript
29 lines
583 B
JavaScript
const { PacketType } = require("..");
|
|
const helpers = require("./helpers.js");
|
|
|
|
describe("parser", () => {
|
|
it("encodes a Buffer", (done) => {
|
|
helpers.test_bin(
|
|
{
|
|
type: PacketType.BINARY_EVENT,
|
|
data: ["a", Buffer.from("abc", "utf8")],
|
|
id: 23,
|
|
nsp: "/cool",
|
|
},
|
|
done
|
|
);
|
|
});
|
|
|
|
it("encodes a binary ack with Buffer", (done) => {
|
|
helpers.test_bin(
|
|
{
|
|
type: PacketType.BINARY_ACK,
|
|
data: ["a", Buffer.from("xxx", "utf8"), {}],
|
|
id: 127,
|
|
nsp: "/back",
|
|
},
|
|
done
|
|
);
|
|
});
|
|
});
|