test(all): removed deprecarted `new Buffer()` construct
MODIFY
packages/core/src/+internal/files/fileReader.helper.spec.ts
packages/core/src/+internal/files/fileReader.helper.spec.ts
@@ -35,7 +35,7 @@ describe('File reader', () => {
it('#readFile returns Buffer when found', done => {
// given
const mockedData = 'test_data';
- const mockedBuffer = new Buffer(mockedData);
+ const mockedBuffer = Buffer.from(mockedData);
// when
const readFileStub = (_, callback) => callback(undefined, mockedBuffer);

MODIFY
packages/core/src/response/specs/responseContentType.factory.spec.ts
packages/core/src/response/specs/responseContentType.factory.spec.ts
@@ -6,7 +6,7 @@ describe('Response content-type factory', () => {
it('#getMimeType detects mime-type from path', () => {
// given
- const body = new Buffer('test');
+ const body = Buffer.from('test');
const path = '/test/index.html';
// when
@@ -30,7 +30,7 @@ describe('Response content-type factory', () => {
it('#getMimeType returns DEFAULT_CONTENT_TYPE', () => {
// given
- const body = new Buffer('test');
+ const body = Buffer.from('test');
const path = '/test/index';
// when

MODIFY
packages/middleware-body/src/specs/body.middleware.spec.ts
packages/middleware-body/src/specs/body.middleware.spec.ts
@@ -120,7 +120,7 @@ describe('bodyParser$ middleware', () => {
const http$ = bodyParser$()(req$, ctx);
http$.subscribe(data => {
- expect(data.body).toEqual(new Buffer(message));
+ expect(data.body).toEqual(Buffer.from(message));
done();
});

MODIFY
packages/websockets/src/operators/mapToServer/mapToServer.operator.spec.ts
packages/websockets/src/operators/mapToServer/mapToServer.operator.spec.ts
@@ -9,7 +9,7 @@ describe('#mapToServer operator', () => {
let bufferMock;
beforeEach(() => {
- bufferMock = new Buffer('');
+ bufferMock = Buffer.from('');
socketMock = { destroy: jest.fn() };
webSocketServerMock = {
handleUpgrade: jest.fn((req, socket, head, done) => done()),

test(all): removed deprecarted `new Buffer()` construct