diff options
author | Andrei Cioromila <andrei.cioromila@gmail.com> | 2017-05-07 14:12:30 +0300 |
---|---|---|
committer | Luigi Pinca <luigipinca@gmail.com> | 2017-05-16 12:10:37 +0200 |
commit | 7906ed50fab6d3e8f6bd259484c465f2df1bc754 (patch) | |
tree | af697ea27b3ddf93c96f68d87e608ccf0ed18efb /test/parallel/test-url-parse-invalid-input.js | |
parent | 92f3b301ab706d6254814b3f0a2689a32bbafb01 (diff) | |
download | android-node-v8-7906ed50fab6d3e8f6bd259484c465f2df1bc754.tar.gz android-node-v8-7906ed50fab6d3e8f6bd259484c465f2df1bc754.tar.bz2 android-node-v8-7906ed50fab6d3e8f6bd259484c465f2df1bc754.zip |
test: add regex check in test-url-parse-invalid-input
Use a regex to validate the error message.
PR-URL: https://github.com/nodejs/node/pull/12879
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: David Cai <davidcai1993@yahoo.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-url-parse-invalid-input.js')
-rw-r--r-- | test/parallel/test-url-parse-invalid-input.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/parallel/test-url-parse-invalid-input.js b/test/parallel/test-url-parse-invalid-input.js index 688d48beb6..a6de25e10c 100644 --- a/test/parallel/test-url-parse-invalid-input.js +++ b/test/parallel/test-url-parse-invalid-input.js @@ -12,9 +12,13 @@ const url = require('url'); 0.0, 0, [], - {} -].forEach(function(val) { - assert.throws(function() { url.parse(val); }, TypeError); + {}, + () => {}, + Symbol('foo') +].forEach((val) => { + assert.throws(() => { url.parse(val); }, + /^TypeError: Parameter "url" must be a string, not (undefined|boolean|number|object|function|symbol)$/); }); -assert.throws(function() { url.parse('http://%E0%A4%A@fail'); }, /^URIError: URI malformed$/); +assert.throws(() => { url.parse('http://%E0%A4%A@fail'); }, + /^URIError: URI malformed$/); |