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() {
|
const expectedError =
|
||||||
b.includes(function() { });
|
/^TypeError: "val" argument must be string, number, Buffer or Uint8Array$/;
|
||||||
});
|
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…
x
Reference in New Issue
Block a user