Skip to content

Commit

Permalink
test/url: Add unit tests for Plus Sign handling
Browse files Browse the repository at this point in the history
  • Loading branch information
besfahbod committed Mar 19, 2020
1 parent e28a567 commit 5de9414
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,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 u = new Url('http://localhost/path with space');
assert.equal(u.toString().toLowerCase(),'http://localhost/path%20with%20space');
assert.equal(u.toString(),'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 u = new Url('http://localhost/path+with+plus');
assert.equal(u.toString(), 'http://localhost/path%2bwith%2bplus');
});
xit('should preserve Plus Sign (+) in path.', function () {
const u = new Url('http://localhost/path+with+plus');
assert.equal(u.toString(), 'http://localhost/path%2bwith%2bplus');
});
});

0 comments on commit 5de9414

Please sign in to comment.