Skip to content

Commit cda0cca

Browse files
toboidgibfahn
authored andcommitted
test: improve test-buffer-includes.js
* verify error message * use arrow funcs PR-URL: #11203 Backport-PR-URL: #13785 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]>
1 parent 1e889b8 commit cda0cca

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/parallel/test-buffer-includes.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,17 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
273273
}
274274
}
275275

276-
assert.throws(function() {
277-
b.includes(function() { });
278-
});
279-
assert.throws(function() {
276+
const expectedError =
277+
/^TypeError: "val" argument must be string, number or Buffer$/;
278+
assert.throws(() => {
279+
b.includes(() => {});
280+
}, expectedError);
281+
assert.throws(() => {
280282
b.includes({});
281-
});
282-
assert.throws(function() {
283+
}, expectedError);
284+
assert.throws(() => {
283285
b.includes([]);
284-
});
286+
}, expectedError);
285287

286288
// test truncation of Number arguments to uint8
287289
{

0 commit comments

Comments
 (0)