From e0c9869ab4febcda023b890078e5e4e878451a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 26 Nov 2016 10:20:05 +0100 Subject: [PATCH] test: refactor and fix test-buffer-bytelength * assert.equal -> assert.strictEqual. * Fix incorrect use of string instead of RegExp in `throws` assertions. --- test/parallel/test-buffer-bytelength.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-buffer-bytelength.js b/test/parallel/test-buffer-bytelength.js index de122b4fc7c737..e31e514ffa1182 100644 --- a/test/parallel/test-buffer-bytelength.js +++ b/test/parallel/test-buffer-bytelength.js @@ -8,13 +8,13 @@ const vm = require('vm'); // coerce values to string assert.throws(() => { Buffer.byteLength(32, 'latin1'); }, - '"string" must be a string, Buffer, or ArrayBuffer'); + /"string" must be a string, Buffer, or ArrayBuffer/); assert.throws(() => { Buffer.byteLength(NaN, 'utf8'); }, - '"string" must be a string, Buffer, or ArrayBuffer'); + /"string" must be a string, Buffer, or ArrayBuffer/); assert.throws(() => { Buffer.byteLength({}, 'latin1'); }, - '"string" must be a string, Buffer, or ArrayBuffer'); + /"string" must be a string, Buffer, or ArrayBuffer/); assert.throws(() => { Buffer.byteLength(); }, - '"string" must be a string, Buffer, or ArrayBuffer'); + /"string" must be a string, Buffer, or ArrayBuffer/); assert(ArrayBuffer.isView(new Buffer(10))); assert(ArrayBuffer.isView(new SlowBuffer(10))); @@ -31,7 +31,7 @@ assert.strictEqual(Buffer.byteLength(ascii), 3); // ArrayBuffer var buffer = new ArrayBuffer(8); -assert.equal(Buffer.byteLength(buffer), 8); +assert.strictEqual(Buffer.byteLength(buffer), 8); // TypedArray var int8 = new Int8Array(8);