From 732bcd8a368d50995c796373e37be5a4d3b2bc8c Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sat, 16 Oct 2010 16:13:53 +0100 Subject: Add missing tests for toKeyValue() function --- test/AngularSpec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/AngularSpec.js') diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 6faed707..64fd8997 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -104,3 +104,14 @@ describe('parseKeyValue', function() { toEqual({flag1: true, key: 'value', flag2: true}); }); }); + +describe('toKeyValue', function() { + it('should parse key-value pairs into string', function() { + expect(toKeyValue({})).toEqual(''); + expect(toKeyValue({simple: 'pair'})).toEqual('simple=pair'); + expect(toKeyValue({first: '1', second: '2'})).toEqual('first=1&second=2'); + expect(toKeyValue({'escaped key': 'escaped value'})). + toEqual('escaped%20key=escaped%20value'); + expect(toKeyValue({emptyKey: ''})).toEqual('emptyKey='); + }); +}); -- cgit v1.2.3