From c0b7bae9d388207dbc4618f1dc4a1482643f9378 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Tue, 13 Oct 2015 10:05:10 -0700 Subject: [PATCH] test(router): add missing tests for the url parser --- modules/angular2/test/router/url_parser_spec.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/angular2/test/router/url_parser_spec.ts b/modules/angular2/test/router/url_parser_spec.ts index 2fd8b6ef2d..12fd02c25c 100644 --- a/modules/angular2/test/router/url_parser_spec.ts +++ b/modules/angular2/test/router/url_parser_spec.ts @@ -29,6 +29,11 @@ export function main() { expect(url.toString()).toEqual('hello/there'); }); + it('should parse an empty URL', () => { + var url = urlParser.parse(''); + expect(url.toString()).toEqual(''); + }); + it('should work with a single aux route', () => { var url = urlParser.parse('hello/there(a)'); expect(url.toString()).toEqual('hello/there(a)'); @@ -79,6 +84,11 @@ export function main() { expect(url.toString()).toEqual('hello/there;hi'); }); + it('should parse a URL with just a query param', () => { + var url = urlParser.parse('?name=bob'); + expect(url.toString()).toEqual('?name=bob'); + }); + it('should parse a key-value query param', () => { var url = urlParser.parse('hello/friend?name=bob'); expect(url.toString()).toEqual('hello/friend?name=bob'); @@ -90,7 +100,7 @@ export function main() { expect(url.toString()).toEqual('hello/there?greeting=hi&whats=up'); }); - it('should parse a key-only matrix param', () => { + it('should parse a key-only query param', () => { var url = urlParser.parse('hello/there?hi'); expect(url.toString()).toEqual('hello/there?hi'); });