diff options
author | Timothy Gu <timothygu99@gmail.com> | 2017-04-21 11:54:58 -0700 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2017-04-25 16:33:08 -0700 |
commit | d457a986a01b84c4cee3a952082caac3f118e1db (patch) | |
tree | 7af9a6c6de2554c28c47ffc8823ed7beeb13e98c /test/parallel/test-internal-errors.js | |
parent | b7a341d7e5868cd1279c33e9f62c388a1e886110 (diff) | |
download | android-node-v8-d457a986a01b84c4cee3a952082caac3f118e1db.tar.gz android-node-v8-d457a986a01b84c4cee3a952082caac3f118e1db.tar.bz2 android-node-v8-d457a986a01b84c4cee3a952082caac3f118e1db.zip |
url: port WHATWG URL API to internal/errors
Also slightly revises grammar.
PR-URL: https://github.com/nodejs/node/pull/12574
Refs: https://github.com/nodejs/node/issues/11273
Refs: https://github.com/nodejs/node/issues/11299
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'test/parallel/test-internal-errors.js')
-rw-r--r-- | test/parallel/test-internal-errors.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index fbd627b030..dd4f02c1f7 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -137,7 +137,7 @@ assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', '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'); + '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'); @@ -150,3 +150,29 @@ assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b', null]), 'The "a" argument must be of type b. Received type null'); + +// Test ERR_INVALID_URL_SCHEME +assert.strictEqual(errors.message('ERR_INVALID_URL_SCHEME', ['file']), + 'The URL must be of scheme file'); +assert.strictEqual(errors.message('ERR_INVALID_URL_SCHEME', [['file']]), + 'The URL must be of scheme file'); +assert.strictEqual(errors.message('ERR_INVALID_URL_SCHEME', [['http', 'ftp']]), + 'The URL must be one of scheme http or ftp'); +assert.strictEqual(errors.message('ERR_INVALID_URL_SCHEME', [['a', 'b', 'c']]), + 'The URL must be one of scheme a, b, or c'); +assert.throws( + () => errors.message('ERR_INVALID_URL_SCHEME', [[]]), + /^AssertionError: At least one expected value needs to be specified$/ +); + +// Test ERR_MISSING_ARGS +assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['name']), + 'The "name" argument must be specified'); +assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['name', 'value']), + 'The "name" and "value" arguments must be specified'); +assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['a', 'b', 'c']), + 'The "a", "b", and "c" arguments must be specified'); +assert.throws( + () => errors.message('ERR_MISSING_ARGS'), + /^AssertionError: At least one arg needs to be specified$/ +); |