summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2017-03-20 14:29:54 -0700
committerJames M Snell <jasnell@gmail.com>2017-04-04 09:51:44 -0700
commitc4469c49ecc2d6624466466e6b496c31d0e9fbed (patch)
treee838ff4c325b7b2b17088d0b0322cfe17199842d /test
parentf6ddbaff8afda2c3f070ae5acb748aac76d06f54 (diff)
downloadandroid-node-v8-c4469c49ecc2d6624466466e6b496c31d0e9fbed.tar.gz
android-node-v8-c4469c49ecc2d6624466466e6b496c31d0e9fbed.tar.bz2
android-node-v8-c4469c49ecc2d6624466466e6b496c31d0e9fbed.zip
url: error when domainTo*() is called w/o argument
PR-URL: https://github.com/nodejs/node/pull/12134 Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-whatwg-url-domainto.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/parallel/test-whatwg-url-domainto.js b/test/parallel/test-whatwg-url-domainto.js
index f891f95a19..70b32c8dce 100644
--- a/test/parallel/test-whatwg-url-domainto.js
+++ b/test/parallel/test-whatwg-url-domainto.js
@@ -13,6 +13,15 @@ const { domainToASCII, domainToUnicode } = require('url');
const tests = require('../fixtures/url-idna.js');
{
+ assert.throws(() => domainToASCII(),
+ /^TypeError: "domain" argument must be specified$/);
+ assert.throws(() => domainToUnicode(),
+ /^TypeError: "domain" argument must be specified$/);
+ assert.strictEqual(domainToASCII(undefined), 'undefined');
+ assert.strictEqual(domainToUnicode(undefined), 'undefined');
+}
+
+{
for (const [i, { ascii, unicode }] of tests.valid.entries()) {
assert.strictEqual(ascii, domainToASCII(unicode),
`domainToASCII(${i + 1})`);