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 6da9d17 commit b6e5cdd
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 @@ -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');
});
});

0 comments on commit b6e5cdd

Please sign in to comment.