Skip to content

Commit

Permalink
Merge branch 'swisstofu-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Mar 27, 2016
2 parents ad3c845 + 54adfed commit 5510b09
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/urlMatcherFactorySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,22 @@ describe("UrlMatcher", function () {
var m = new UrlMatcher('/users/:id/details/{type}/{repeat:[0-9]+}?from&to');
expect(m.exec('/users/123/details/what/thisShouldBeDigits', {})).toBeNull();
});

it("should not use optional regexp for '/'", function () {
var m = new UrlMatcher('/{language:(?:fr|en|de)}');
expect(m.exec('/', {})).toBeNull();
});

it("should work with empty default value", function () {
var m = new UrlMatcher('/foo/:str', { params: { str: { value: "" } } });
expect(m.exec('/foo/', {})).toEqual({ str: "" });
});

it("should work with empty default value for regex", function () {
var m = new UrlMatcher('/foo/{param:(?:foo|bar|)}', { params: { param: { value: "" } } });
expect(m.exec('/foo/', {})).toEqual({ param: "" });
});

it("should treat the URL as already decoded and does not decode it further", function () {
expect(new UrlMatcher('/users/:id').exec('/users/100%25', {})).toEqual({ id: '100%25'});
});
Expand Down

0 comments on commit 5510b09

Please sign in to comment.