From 82cc3f9aadb695fbc474741fead2fbcf8ba8fa7d Mon Sep 17 00:00:00 2001 From: Daryl Thayil Date: Thu, 1 Dec 2016 11:47:27 -0600 Subject: [PATCH 1/3] test: add test for url module domainToAscii and domainToUnicode --- .../parallel/test-url-domain-ascii-unicode.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/parallel/test-url-domain-ascii-unicode.js diff --git a/test/parallel/test-url-domain-ascii-unicode.js b/test/parallel/test-url-domain-ascii-unicode.js new file mode 100644 index 00000000000000..5652f23cc2332b --- /dev/null +++ b/test/parallel/test-url-domain-ascii-unicode.js @@ -0,0 +1,27 @@ +'use strict'; + +require('../common'); +const strictEqual = require('assert').strictEqual; +const url = require('url'); + +const domainToASCII = url.URL.domainToASCII; +const domainToUnicode = url.URL.domainToUnicode; + +const domainWithASCII = [ + ['ıídيٴ', 'xn--d-iga7ro0q9f'], + ['www.ϧƽəʐ.com', 'www.xn--cja62apfr6c.com'], + ['новини.com', 'xn--b1amarcd.com'], + ['名がドメイン.com', 'xn--v8jxj3d1dzdz08w.com'], + ['افغانستا.icom.museum', 'xn--mgbaal8b0b9b2b.icom.museum'], + ['الجزائر.icom.fake', 'xn--lgbbat1ad8j.icom.fake'], + ['भारत.org', 'xn--h2brj9c.org'] +]; + +domainWithASCII.forEach(pair => { + const domain = pair[0]; + const ascii = pair[1]; + const domainConvertedToASCII = domainToASCII(domain); + strictEqual(domainConvertedToASCII, ascii); + const asciiConvertedToUnicode = domainToUnicode(ascii); + strictEqual(asciiConvertedToUnicode, domain); +}); From d5279d9d17c578d18e4fed3cb16e4261f8114cd6 Mon Sep 17 00:00:00 2001 From: Daryl Thayil Date: Mon, 5 Dec 2016 11:00:25 -0800 Subject: [PATCH 2/3] Update test-url-domain-ascii-unicode.js --- test/parallel/test-url-domain-ascii-unicode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-url-domain-ascii-unicode.js b/test/parallel/test-url-domain-ascii-unicode.js index 5652f23cc2332b..59b2d8cdd12f5c 100644 --- a/test/parallel/test-url-domain-ascii-unicode.js +++ b/test/parallel/test-url-domain-ascii-unicode.js @@ -17,7 +17,7 @@ const domainWithASCII = [ ['भारत.org', 'xn--h2brj9c.org'] ]; -domainWithASCII.forEach(pair => { +domainWithASCII.forEach((pair) => { const domain = pair[0]; const ascii = pair[1]; const domainConvertedToASCII = domainToASCII(domain); From 724234ae2b91b42595e68401a863ee2b12ea44e9 Mon Sep 17 00:00:00 2001 From: Daryl Thayil Date: Mon, 5 Dec 2016 14:23:40 -0800 Subject: [PATCH 3/3] Update test-url-domain-ascii-unicode.js --- .../parallel/test-url-domain-ascii-unicode.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-url-domain-ascii-unicode.js b/test/parallel/test-url-domain-ascii-unicode.js index 59b2d8cdd12f5c..f9a6be462504c2 100644 --- a/test/parallel/test-url-domain-ascii-unicode.js +++ b/test/parallel/test-url-domain-ascii-unicode.js @@ -8,20 +8,20 @@ const domainToASCII = url.URL.domainToASCII; const domainToUnicode = url.URL.domainToUnicode; const domainWithASCII = [ - ['ıídيٴ', 'xn--d-iga7ro0q9f'], - ['www.ϧƽəʐ.com', 'www.xn--cja62apfr6c.com'], - ['новини.com', 'xn--b1amarcd.com'], - ['名がドメイン.com', 'xn--v8jxj3d1dzdz08w.com'], - ['افغانستا.icom.museum', 'xn--mgbaal8b0b9b2b.icom.museum'], - ['الجزائر.icom.fake', 'xn--lgbbat1ad8j.icom.fake'], - ['भारत.org', 'xn--h2brj9c.org'] + ['ıídيٴ', 'xn--d-iga7ro0q9f'], + ['www.ϧƽəʐ.com', 'www.xn--cja62apfr6c.com'], + ['новини.com', 'xn--b1amarcd.com'], + ['名がドメイン.com', 'xn--v8jxj3d1dzdz08w.com'], + ['افغانستا.icom.museum', 'xn--mgbaal8b0b9b2b.icom.museum'], + ['الجزائر.icom.fake', 'xn--lgbbat1ad8j.icom.fake'], + ['भारत.org', 'xn--h2brj9c.org'] ]; domainWithASCII.forEach((pair) => { - const domain = pair[0]; - const ascii = pair[1]; - const domainConvertedToASCII = domainToASCII(domain); - strictEqual(domainConvertedToASCII, ascii); - const asciiConvertedToUnicode = domainToUnicode(ascii); - strictEqual(asciiConvertedToUnicode, domain); + const domain = pair[0]; + const ascii = pair[1]; + const domainConvertedToASCII = domainToASCII(domain); + strictEqual(domainConvertedToASCII, ascii); + const asciiConvertedToUnicode = domainToUnicode(ascii); + strictEqual(asciiConvertedToUnicode, domain); });