Skip to content

Commit

Permalink
test: improve test-buffer-includes.js
Browse files Browse the repository at this point in the history
* verify error message
* use arrow funcs

PR-URL: nodejs/node#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 targos committed Jun 19, 2017
1 parent 917e579 commit 4056141
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/parallel/test-buffer-includes.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,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 or Buffer$/;
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
{
Expand Down

0 comments on commit 4056141

Please sign in to comment.