Files
socket.io/test/buffer.js
Damien Arrachequesne fe33ff7c87 test: actually test the parser
The assertions were not checked, because the functions are asynchronous.

Besides, the Blob tests were throwing in the browser:

> Uncaught ReferenceError: can't access lexical declaration 'BlobBuilder' before initialization
2020-09-24 11:48:24 +02:00

23 lines
532 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)
});
});