Skip to content

Commit eec216f

Browse files
watildejasnell
authored andcommitted
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: #11329 Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 5ddf722 commit eec216f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/parallel/test-querystring.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,20 @@ assert.doesNotThrow(function() {
257257
assert.strictEqual(f, 'a:b;q:x%3Ay%3By%3Az');
258258
}
259259

260+
// empty string
261+
assert.strictEqual(qs.stringify(), '');
262+
assert.strictEqual(qs.stringify(0), '');
263+
assert.strictEqual(qs.stringify([]), '');
264+
assert.strictEqual(qs.stringify(null), '');
265+
assert.strictEqual(qs.stringify(true), '');
266+
260267
check(qs.parse(), {});
261268

269+
// empty sep
270+
check(qs.parse('a', []), { a: '' });
271+
272+
// empty eq
273+
check(qs.parse('a', null, []), { '': 'a' });
262274

263275
// Test limiting
264276
assert.strictEqual(

0 commit comments

Comments
 (0)