Skip to content

Commit

Permalink
chore: fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Jul 19, 2022
1 parent 94039ef commit 8042eb6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Layer.prototype.url = function (params, options) {
}
}

const toPath = compile(url, Object.assign({ encode: encodeURIComponent }, options));
const toPath = compile(url, { encode: encodeURIComponent, ...options });
let replaced;

const tokens = parse(url);
Expand Down
11 changes: 8 additions & 3 deletions test/lib/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,14 @@ describe('Layer', function () {
url.should.equal('/programming/how-to-node');
});

it('escapes using encodeURIComponent()', function() {
const route = new Layer('/:category/:title', ['get'], [function () {}], {name: 'books'});
const url = route.url({ category: 'programming', title: 'how to node & js/ts' });
it('escapes using encodeURIComponent()', function () {
const route = new Layer('/:category/:title', ['get'], [function () {}], {
name: 'books'
});
const url = route.url({
category: 'programming',
title: 'how to node & js/ts'
});
url.should.equal('/programming/how%20to%20node%20%26%20js%2Fts');
});

Expand Down
10 changes: 5 additions & 5 deletions test/lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1675,11 +1675,11 @@ describe('Router', function () {
router.url(Symbol('books')).should.be.Error();
});

it('escapes using encodeURIComponent()', function() {
const url = Router.url(
'/:category/:title',
{ category: 'programming', title: 'how to node & js/ts' }
);
it('escapes using encodeURIComponent()', function () {
const url = Router.url('/:category/:title', {
category: 'programming',
title: 'how to node & js/ts'
});
url.should.equal('/programming/how%20to%20node%20%26%20js%2Fts');
});
});
Expand Down

0 comments on commit 8042eb6

Please sign in to comment.