Browse Source

test: cases to querystring related to empty string

+ Add cases to `qs.stringify` that return empty string
+ Add cases to `qs.parse` when `sep` or `eq` is empty

PR-URL: https://github.com/nodejs/node/pull/11329
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v6.x
Daijiro Wachi 8 years ago
committed by Myles Borins
parent
commit
e7b7d7279c
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 12
      test/parallel/test-querystring.js

12
test/parallel/test-querystring.js

@ -231,8 +231,20 @@ assert.doesNotThrow(function() {
assert.equal(f, 'a:b;q:x%3Ay%3By%3Az');
}
// empty string
assert.strictEqual(qs.stringify(), '');
assert.strictEqual(qs.stringify(0), '');
assert.strictEqual(qs.stringify([]), '');
assert.strictEqual(qs.stringify(null), '');
assert.strictEqual(qs.stringify(true), '');
check(qs.parse(), {});
// empty sep
check(qs.parse('a', []), { a: '' });
// empty eq
check(qs.parse('a', null, []), { '': 'a' });
// Test limiting
assert.equal(

Loading…
Cancel
Save