mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: write tests for assertIsArray http2 util
PR-URL: https://github.com/nodejs/node/pull/52511 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
1 parent
0debfa460f
commit
1703ab50c7
1 file changed
+30
-1
@@ -9,7 +9,8 @@ const assert = require('assert');
|
||||
const {
|
||||
assertIsObject,
|
||||
assertWithinRange,
|
||||
sessionName
|
||||
sessionName,
|
||||
assertIsArray
|
||||
} = require('internal/http2/util');
|
||||
|
||||
// Code coverage for sessionName utility function
|
||||
@@ -49,3 +50,31 @@ assert.throws(
|
||||
});
|
||||
|
||||
assertIsObject({}, 'test');
|
||||
|
||||
assert.throws(
|
||||
() => assertIsArray('foo', 'test'), {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError',
|
||||
message: 'The "test" argument must be an instance of Array. Received type ' +
|
||||
"string ('foo')"
|
||||
}
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() => assertIsArray({}, 'test'), {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError',
|
||||
message: 'The "test" argument must be an instance of Array. Received an instance of Object'
|
||||
}
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() => assertIsArray(1, 'test'), {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError',
|
||||
message: 'The "test" argument must be an instance of Array. Received type ' +
|
||||
'number (1)'
|
||||
}
|
||||
);
|
||||
|
||||
assertIsArray([], 'test');
|
||||
Reference in new issue
Block a user