diff --git a/test/urlMatcherFactorySpec.js b/test/urlMatcherFactorySpec.js index 012982d16..594daccbc 100755 --- a/test/urlMatcherFactorySpec.js +++ b/test/urlMatcherFactorySpec.js @@ -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'}); });