Permalink
Browse files

test: improve test-buffer-includes.js

* verify error message
* use arrow funcs

PR-URL: #11203
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>
  • Loading branch information...
toboid authored and jasnell committed Feb 6, 2017
1 parent f65aa08 commit 1544d8f04b1d9a3502c6156cfc5be727ba711e19
Showing with 9 additions and 7 deletions.
  1. +9 −7 test/parallel/test-buffer-includes.js
@@ -275,15 +275,17 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
}
}
assert.throws(function() {
b.includes(function() { });
});
assert.throws(function() {
const expectedError =
/^TypeError: "val" argument must be string, number, Buffer or Uint8Array$/;
assert.throws(() => {
b.includes(() => {});
}, expectedError);
assert.throws(() => {
b.includes({});
});
assert.throws(function() {
}, expectedError);
assert.throws(() => {
b.includes([]);
});
}, expectedError);
// test truncation of Number arguments to uint8
{

0 comments on commit 1544d8f

Please sign in to comment.