Skip to content

Commit c0b7bae

Browse files
committed
test(router): add missing tests for the url parser
1 parent 8bc40d3 commit c0b7bae

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

modules/angular2/test/router/url_parser_spec.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export function main() {
2929
expect(url.toString()).toEqual('hello/there');
3030
});
3131

32+
it('should parse an empty URL', () => {
33+
var url = urlParser.parse('');
34+
expect(url.toString()).toEqual('');
35+
});
36+
3237
it('should work with a single aux route', () => {
3338
var url = urlParser.parse('hello/there(a)');
3439
expect(url.toString()).toEqual('hello/there(a)');
@@ -79,6 +84,11 @@ export function main() {
7984
expect(url.toString()).toEqual('hello/there;hi');
8085
});
8186

87+
it('should parse a URL with just a query param', () => {
88+
var url = urlParser.parse('?name=bob');
89+
expect(url.toString()).toEqual('?name=bob');
90+
});
91+
8292
it('should parse a key-value query param', () => {
8393
var url = urlParser.parse('hello/friend?name=bob');
8494
expect(url.toString()).toEqual('hello/friend?name=bob');
@@ -90,7 +100,7 @@ export function main() {
90100
expect(url.toString()).toEqual('hello/there?greeting=hi&whats=up');
91101
});
92102

93-
it('should parse a key-only matrix param', () => {
103+
it('should parse a key-only query param', () => {
94104
var url = urlParser.parse('hello/there?hi');
95105
expect(url.toString()).toEqual('hello/there?hi');
96106
});

0 commit comments

Comments
 (0)