Skip to content

Commit

Permalink
Add few tests about decoding uri params
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzzy committed Oct 9, 2016
1 parent 2954864 commit 6dadc6f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/matchPath.spec.js
Expand Up @@ -65,6 +65,16 @@ describe('matchPath(routePath, urlPath)', () => {
expect(result).to.be.deep.equal({ path: '/f', keys: [], params: {} });
});

it('should decode params correctly', () => {
const result = matchPath('/:a/:b/:c', '/caf%C3%A9/%2F/%3A');
expect(result.params).to.be.deep.equal({ a: 'café', b: '/', c: ':' });
});

it('should throw en error for malformed URI params', () => {
const fn = matchPath.bind(undefined, '/:a', '/%AF');
expect(fn).to.throw(URIError, 'Failed to decode param \'%AF\'');
});

});

describe('matchBasePath(routePath, urlPath)', () => {
Expand Down

0 comments on commit 6dadc6f

Please sign in to comment.