diff --git a/package.json b/package.json index eac5bc9..f1e7847 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "type": "commonjs", "dependencies": {}, "devDependencies": { - "tap": "~13.1.11" + "tap": "~11.1.5" }, "optionalDependencies": {}, "engines": { diff --git a/tests/crc.test.js b/tests/crc.test.js index cbf11fe..048801b 100644 --- a/tests/crc.test.js +++ b/tests/crc.test.js @@ -2,36 +2,36 @@ const crc32 = require('..'); const test = require('tap').test; test('simple crc32 is no problem', function (t) { - var input = new Buffer('hey sup bros'); - var expected = new Buffer([0x47, 0xfa, 0x55, 0x70]); + var input = Buffer.from('hey sup bros'); + var expected = Buffer.from([0x47, 0xfa, 0x55, 0x70]); t.same(crc32(input), expected); t.end(); }); test('another simple one', function (t) { - var input = new Buffer('IEND'); - var expected = new Buffer([0xae, 0x42, 0x60, 0x82]); + var input = Buffer.from('IEND'); + var expected = Buffer.from([0xae, 0x42, 0x60, 0x82]); t.same(crc32(input), expected); t.end(); }); test('slightly more complex', function (t) { - var input = new Buffer([0x00, 0x00, 0x00]); - var expected = new Buffer([0xff, 0x41, 0xd9, 0x12]); + var input = Buffer.from([0x00, 0x00, 0x00]); + var expected = Buffer.from([0xff, 0x41, 0xd9, 0x12]); t.same(crc32(input), expected); t.end(); }); test('complex crc32 gets calculated like a champ', function (t) { - var input = new Buffer('शीर्षक'); - var expected = new Buffer([0x17, 0xb8, 0xaf, 0xf1]); + var input = Buffer.from('शीर्षक'); + var expected = Buffer.from([0x17, 0xb8, 0xaf, 0xf1]); t.same(crc32(input), expected); t.end(); }); test('casts to buffer if necessary', function (t) { var input = 'शीर्षक'; - var expected = new Buffer([0x17, 0xb8, 0xaf, 0xf1]); + var expected = Buffer.from([0x17, 0xb8, 0xaf, 0xf1]); t.same(crc32(input), expected); t.end(); }); @@ -52,8 +52,8 @@ test('can do unsigned', function (t) { test('simple crc32 in append mode', function (t) { - var input = [new Buffer('hey'), new Buffer(' '), new Buffer('sup'), new Buffer(' '), new Buffer('bros')]; - var expected = new Buffer([0x47, 0xfa, 0x55, 0x70]); + var input = [Buffer.from('hey'), Buffer.from(' '), Buffer.from('sup'), Buffer.from(' '), Buffer.from('bros')]; + var expected = Buffer.from([0x47, 0xfa, 0x55, 0x70]); for (var crc = 0, i = 0; i < input.length; i++) { crc = crc32(input[i], crc); } @@ -78,7 +78,7 @@ test('can do signed in append mode', function (t) { test('make sure crc32 can accept integers as first arg ', function (t) { try { - t.same(crc32(0), new Buffer([0x00, 0x00, 0x00, 0x00])); + t.same(crc32(0), Buffer.from([0x00, 0x00, 0x00, 0x00])); } catch (e) { t.fail("should be able to accept integer"); } finally {