From 6f866ae0020099c36ba9377cbbc8f8a836899d06 Mon Sep 17 00:00:00 2001 From: Sebastian Van Sande Date: Fri, 3 Feb 2017 13:11:46 +0100 Subject: [PATCH] test: improve punycode test coverage Adds two additional tests for mapDomain function in punycode.js. When an email address is given to the toASCII() and toUnicode() functions, only the parts before the '@' character should be encoded/decoded. PR-URL: https://github.com/nodejs/node/pull/11144 Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani --- test/parallel/test-punycode.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/parallel/test-punycode.js b/test/parallel/test-punycode.js index 60175557042ff9..b95d33fdb261a0 100644 --- a/test/parallel/test-punycode.js +++ b/test/parallel/test-punycode.js @@ -237,3 +237,9 @@ assert.strictEqual(punycode.ucs2.encode([0xDC00]), '\uDC00'); assert.strictEqual(punycode.ucs2.encode([0xDC00, 0x61, 0x62]), '\uDC00ab'); assert.strictEqual(errors, 0); + +// test map domain +assert.strictEqual(punycode.toASCII('Bücher@日本語.com'), + 'Bücher@xn--wgv71a119e.com'); +assert.strictEqual(punycode.toUnicode('Bücher@xn--wgv71a119e.com'), + 'Bücher@日本語.com');