test: improve test-buffer-includes.js
* verify error message * use arrow funcs PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
f65aa08b52
commit
1544d8f04b
@ -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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user