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#11203
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
toboid authored and krydos committed Feb 25, 2017
1 parent e58ef29 commit acbf498
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 @@ -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
{
Expand Down

0 comments on commit acbf498

Please sign in to comment.