Skip to content

Commit f8e38ef

Browse files
committed
fix(util): getQueryString tests
1 parent fcaad95 commit f8e38ef

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

ionic/util/test/util.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@ import * as util from 'ionic-angular/util';
33
export function run() {
44
describe('extend', function() {
55

6+
describe('getQuerystring', function() {
7+
it('should have no entries for empty url', () => {
8+
expect(util.getQuerystring('')).toEqual({});
9+
});
10+
11+
it('should have no entries for url with no "?" character', () => {
12+
expect(util.getQuerystring('http://localhost:1234/#key1=1&key2=2')).toEqual({});
13+
});
14+
15+
it('should contain key/value entries for all the parameters after "?" character', () => {
16+
expect(util.getQuerystring('http://localhost:1234/#key0=0&key0x=0x?key1=1&key2=2')).toEqual({
17+
key1: '1',
18+
key2: '2'
19+
});
20+
});
21+
22+
it('should ignore empty ?& and &&', () => {
23+
expect(util.getQuerystring('http://localhost:1234/#?&&')).toEqual({});
24+
25+
expect(util.getQuerystring('http://localhost:1234/#?&&key1=1&key2=2&&')).toEqual({
26+
key1: '1',
27+
key2: '2'
28+
});
29+
});
30+
});
31+
632
describe('isTrueProperty', function() {
733

834
it('should be true from boolean true', () => {

0 commit comments

Comments
 (0)