Fix Issue 684: Replace var with const, let in filer/tests/spec/filer.buffer.spec.js (#697)

* refactored code in tests/spec/filer.buffer.spec.js

* reverted changes to package-lock.json which shouldn't have been changed

* updated package-lock.json

* trying to fix bug

* roll back changes to package-lock.json, change lets to consts in filer.buffer.spec.js, added new line at the end of filer.buffer.spec.js
This commit is contained in:
Rachael Scotchmer 2019-02-01 12:45:54 -05:00 committed by David Humphrey
parent 8eaaeeed17
commit 4ba9eded4c
1 changed files with 17 additions and 15 deletions

View File

@ -1,5 +1,7 @@
var Filer = require('../../src'); 'use strict';
var expect = require('chai').expect;
const Filer = require('../../src');
const expect = require('chai').expect;
describe('Filer.Buffer', function() { describe('Filer.Buffer', function() {
@ -12,37 +14,37 @@ describe('Filer.Buffer', function() {
}); });
it('should support .isBuffer()', function() { it('should support .isBuffer()', function() {
var buf = Buffer.alloc(0); const buf = Buffer.alloc(0);
expect(Buffer.isBuffer(buf)).to.be.true; expect(Buffer.isBuffer(buf)).to.be.true;
}); });
describe('Deprecation checks - constructor vs. class method init', function() { describe('Deprecation checks - constructor vs. class method init', function() {
it('should allow new Buffer(array)', function() { it('should allow new Buffer(array)', function() {
var arr = [1, 2, 3]; const arr = [1, 2, 3];
var buf1 = new Buffer(arr); const buf1 = new Buffer(arr);
var buf2 = new Buffer.from(arr); const buf2 = new Buffer.from(arr);
expect(buf1).to.deep.equal(buf2); expect(buf1).to.deep.equal(buf2);
}); });
it('should allow new Buffer(ArrayBuffer)', function() { it('should allow new Buffer(ArrayBuffer)', function() {
var arrayBuffer = (new Uint8Array([1, 2, 3])).buffer; const arrayBuffer = (new Uint8Array([1, 2, 3])).buffer;
var buf1 = new Buffer(arrayBuffer); const buf1 = new Buffer(arrayBuffer);
var buf2 = Buffer.from(arrayBuffer); const buf2 = Buffer.from(arrayBuffer);
expect(buf1).to.deep.equal(buf2); expect(buf1).to.deep.equal(buf2);
}); });
it('should allow new Buffer(ArrayBuffer)', function() { it('should allow new Buffer(ArrayBuffer)', function() {
var buffer = new Buffer.from([1, 2, 3]); const buffer = new Buffer.from([1, 2, 3]);
var buf1 = new Buffer(buffer); const buf1 = new Buffer(buffer);
var buf2 = Buffer.from(buffer); const buf2 = Buffer.from(buffer);
expect(buf1).to.deep.equal(buf2); expect(buf1).to.deep.equal(buf2);
}); });
it('should allow new Buffer(string)', function() { it('should allow new Buffer(string)', function() {
var s = 'Hello World'; const s = 'Hello World';
var buf1 = new Buffer(s); const buf1 = new Buffer(s);
var buf2 = Buffer.from(s); const buf2 = Buffer.from(s);
expect(buf1).to.deep.equal(buf2); expect(buf1).to.deep.equal(buf2);
}); });
}); });