Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions tests/spec/filer.buffer.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var Filer = require('../../src');
var expect = require('chai').expect;
'use strict';

const Filer = require('../../src');
const expect = require('chai').expect;

describe('Filer.Buffer', function() {

Expand All @@ -12,37 +14,37 @@ describe('Filer.Buffer', function() {
});

it('should support .isBuffer()', function() {
var buf = Buffer.alloc(0);
const buf = Buffer.alloc(0);
expect(Buffer.isBuffer(buf)).to.be.true;
});

describe('Deprecation checks - constructor vs. class method init', function() {

it('should allow new Buffer(array)', function() {
var arr = [1, 2, 3];
var buf1 = new Buffer(arr);
var buf2 = new Buffer.from(arr);
const arr = [1, 2, 3];
const buf1 = new Buffer(arr);
const buf2 = new Buffer.from(arr);
expect(buf1).to.deep.equal(buf2);
});

it('should allow new Buffer(ArrayBuffer)', function() {
var arrayBuffer = (new Uint8Array([1, 2, 3])).buffer;
var buf1 = new Buffer(arrayBuffer);
var buf2 = Buffer.from(arrayBuffer);
const arrayBuffer = (new Uint8Array([1, 2, 3])).buffer;
const buf1 = new Buffer(arrayBuffer);
const buf2 = Buffer.from(arrayBuffer);
expect(buf1).to.deep.equal(buf2);
});

it('should allow new Buffer(ArrayBuffer)', function() {
var buffer = new Buffer.from([1, 2, 3]);
var buf1 = new Buffer(buffer);
var buf2 = Buffer.from(buffer);
const buffer = new Buffer.from([1, 2, 3]);
const buf1 = new Buffer(buffer);
const buf2 = Buffer.from(buffer);
expect(buf1).to.deep.equal(buf2);
});

it('should allow new Buffer(string)', function() {
var s = 'Hello World';
var buf1 = new Buffer(s);
var buf2 = Buffer.from(s);
const s = 'Hello World';
const buf1 = new Buffer(s);
const buf2 = Buffer.from(s);
expect(buf1).to.deep.equal(buf2);
});
});
Expand Down