11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciif (!common.hasIntl)
51cb0ef41Sopenharmony_ci  common.skip('missing Intl');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst strictEqual = require('assert').strictEqual;
81cb0ef41Sopenharmony_ciconst url = require('url');
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciconst domainToASCII = url.domainToASCII;
111cb0ef41Sopenharmony_ciconst domainToUnicode = url.domainToUnicode;
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciconst domainWithASCII = [
141cb0ef41Sopenharmony_ci  ['ıíd', 'xn--d-iga7r'],
151cb0ef41Sopenharmony_ci  ['يٴ', 'xn--mhb8f'],
161cb0ef41Sopenharmony_ci  ['www.ϧƽəʐ.com', 'www.xn--cja62apfr6c.com'],
171cb0ef41Sopenharmony_ci  ['новини.com', 'xn--b1amarcd.com'],
181cb0ef41Sopenharmony_ci  ['名がドメイン.com', 'xn--v8jxj3d1dzdz08w.com'],
191cb0ef41Sopenharmony_ci  ['افغانستا.icom.museum', 'xn--mgbaal8b0b9b2b.icom.museum'],
201cb0ef41Sopenharmony_ci  ['الجزائر.icom.fake', 'xn--lgbbat1ad8j.icom.fake'],
211cb0ef41Sopenharmony_ci  ['भारत.org', 'xn--h2brj9c.org'],
221cb0ef41Sopenharmony_ci];
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_cidomainWithASCII.forEach((pair) => {
251cb0ef41Sopenharmony_ci  const domain = pair[0];
261cb0ef41Sopenharmony_ci  const ascii = pair[1];
271cb0ef41Sopenharmony_ci  const domainConvertedToASCII = domainToASCII(domain);
281cb0ef41Sopenharmony_ci  strictEqual(domainConvertedToASCII, ascii);
291cb0ef41Sopenharmony_ci  const asciiConvertedToUnicode = domainToUnicode(ascii);
301cb0ef41Sopenharmony_ci  strictEqual(asciiConvertedToUnicode, domain);
311cb0ef41Sopenharmony_ci});
32