Files
ws/test/buffer-util.test.js
Сковорода Никита Андреевич 08c6c8ba70 [fix] Ensure that concat() never returns uninitialized data (#1600)
This is just a safeguard that ensures that for cases if `totalLength`
is by some mistake miscalculated, no uninitialized memory would be
leaked.
2019-09-15 09:14:54 +02:00

16 lines
360 B
JavaScript

'use strict';
const assert = require('assert');
const { concat } = require('../lib/buffer-util');
describe('bufferUtil', () => {
describe('concat', () => {
it('never returns uninitialized data', () => {
const buf = concat([Buffer.from([1, 2]), Buffer.from([3, 4])], 6);
assert.ok(buf.equals(Buffer.from([1, 2, 3, 4])));
});
});
});