test_helpers.js (776B)
1 var assert = require('assert') 2 var helpers = require('../lib/helpers') 3 4 describe('makeQueryString', function () { 5 it('correctly encodes Objects with String values', function () { 6 assert.equal(helpers.makeQueryString({a: 'Ladies + Gentlemen'}), 'a=Ladies%20%2B%20Gentlemen'); 7 assert.equal(helpers.makeQueryString({a: 'An encoded string!'}), 'a=An%20encoded%20string%21'); 8 assert.equal(helpers.makeQueryString({a: 'Dogs, Cats & Mice'}), 'a=Dogs%2C%20Cats%20%26%20Mice') 9 assert.equal(helpers.makeQueryString({a: '☃'}), 'a=%E2%98%83') 10 assert.equal(helpers.makeQueryString({a: '#haiku #poetry'}), 'a=%23haiku%20%23poetry') 11 assert.equal(helpers.makeQueryString({a: '"happy hour" :)'}), 'a=%22happy%20hour%22%20%3A%29') 12 }) 13 })