Browse Source

test: improve test-buffer-includes.js

* verify error message
* use arrow funcs

PR-URL: https://github.com/nodejs/node/pull/11203
Backport-PR-URL: https://github.com/nodejs/node/pull/13785
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
toboid 8 years ago
committed by Myles Borins
parent
commit
9e7f02187a
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 16
      test/parallel/test-buffer-includes.js

16
test/parallel/test-buffer-includes.js

@ -273,15 +273,17 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
} }
} }
assert.throws(function() { const expectedError =
b.includes(function() { }); /^TypeError: "val" argument must be string, number or Buffer$/;
}); assert.throws(() => {
assert.throws(function() { b.includes(() => {});
}, expectedError);
assert.throws(() => {
b.includes({}); b.includes({});
}); }, expectedError);
assert.throws(function() { assert.throws(() => {
b.includes([]); b.includes([]);
}); }, expectedError);
// test truncation of Number arguments to uint8 // test truncation of Number arguments to uint8
{ {

Loading…
Cancel
Save