aboutsummaryrefslogtreecommitdiffstats
path: root/test/AngularSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/AngularSpec.js')
-rw-r--r--test/AngularSpec.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index b4e90175..725e8ea0 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -79,5 +79,17 @@ describe('equals', function(){
expect(equals({name:'misko'}, {name:'misko', $id:2})).toEqual(true);
expect(equals({name:'misko', $id:1}, {name:'misko'})).toEqual(true);
});
-
});
+
+describe('parseKeyValue', function() {
+ it('should parse a string into key-value pairs', function() {
+ expect(parseKeyValue('')).toEqual({});
+ expect(parseKeyValue('simple=pair')).toEqual({simple: 'pair'});
+ expect(parseKeyValue('first=1&second=2')).toEqual({first: '1', second: '2'});
+ expect(parseKeyValue('escaped%20key=escaped%20value')).
+ toEqual({'escaped key': 'escaped value'});
+ expect(parseKeyValue('emptyKey=')).toEqual({emptyKey: ''});
+ expect(parseKeyValue('flag1&key=value&flag2')).
+ toEqual({flag1: true, key: 'value', flag2: true});
+ });
+})