From b6e5cdddd399fe4e3bbe4d3c1bc689d7fe5cd3f5 Mon Sep 17 00:00:00 2001 From: Behnam Esfahbod Date: Thu, 19 Mar 2020 14:33:16 -0700 Subject: [PATCH] test/url: Add unit tests for Plus Sign handling See https://github.com/Mikhus/domurl/issues/49 --- test/url.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/url.js b/test/url.js index 2dc4c3b..25e07bd 100644 --- a/test/url.js +++ b/test/url.js @@ -140,8 +140,17 @@ describe('Url props interface', function () { }); describe('Path url encoding', function () { - it('should correctly encode whitespace with %20', function () { + it('should correctly encode whitespace as %20', function () { const url = new Url('http://localhost/path with space').toString(); - assert.equal(url.toLowerCase(),'http://localhost/path%20with%20space'); + assert.equal(url, 'http://localhost/path%20with%20space'); + }); + // TODO: Fix https://github.com/Mikhus/domurl/issues/49 + xit('should correctly encode Plus Sign (+) to %2b in path.', function () { + const url = new Url('http://localhost/path+with+plus').toString(); + assert.equal(url, 'http://localhost/path%2bwith%2bplus'); + }); + xit('should preserve Plus Sign (+) in path.', function () { + const url = new Url('http://localhost/path+with+plus').toString(); + assert.equal(url, 'http://localhost/path%2bwith%2bplus'); }); });