aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-internal-errors.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-internal-errors.js')
-rw-r--r--test/parallel/test-internal-errors.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js
index b43d825e6c..fbd627b030 100644
--- a/test/parallel/test-internal-errors.js
+++ b/test/parallel/test-internal-errors.js
@@ -130,3 +130,23 @@ assert.throws(
() => errors.E('TEST_ERROR_USED_SYMBOL'),
/^AssertionError: Error symbol: TEST_ERROR_USED_SYMBOL was already used\.$/
);
+
+// // Test ERR_INVALID_ARG_TYPE
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b']),
+ 'The "a" argument must be of type b');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', ['b']]),
+ 'The "a" argument must be of type b');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', ['b', 'c']]),
+ 'The "a" argument must be one of type b, or c');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE',
+ ['a', ['b', 'c', 'd']]),
+ 'The "a" argument must be one of type b, c, or d');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b', 'c']),
+ 'The "a" argument must be of type b. Received type string');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE',
+ ['a', 'b', undefined]),
+ 'The "a" argument must be of type b. Received type ' +
+ 'undefined');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE',
+ ['a', 'b', null]),
+ 'The "a" argument must be of type b. Received type null');