From 5e8627c721de70283eb98ed60dfac9e958b5c35a Mon Sep 17 00:00:00 2001 From: Daijiro Wachi Date: Mon, 13 Feb 2017 21:51:19 +0100 Subject: [PATCH] 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 --- test/parallel/test-querystring.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index baa426094c77c6..987dde573993bc 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -232,8 +232,20 @@ assert.doesNotThrow(function() { assert.strictEqual(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.strictEqual(