From 1e047010889d912c1a99813e7a548c95a7f22b68 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 29 Feb 2024 14:45:30 -0800 Subject: [PATCH] [Tests] `stringify`: increase coverage --- test/stringify.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/stringify.js b/test/stringify.js index 31a5a705..c9e41ae8 100644 --- a/test/stringify.js +++ b/test/stringify.js @@ -883,13 +883,27 @@ test('stringify()', function (t) { st.end(); }); + t.test('receives the default encoder as a second argument', function (st) { + st.plan(8); + + qs.stringify({ a: 1, b: new Date(), c: true, d: [1] }, { + encoder: function (str) { + st.match(typeof str, /^(?:string|number|boolean)$/); + } + }); + + st.end(); + }); + t.test('receives the default encoder as a second argument', function (st) { st.plan(2); + qs.stringify({ a: 1 }, { encoder: function (str, defaultEncoder) { st.equal(defaultEncoder, utils.encode); } }); + st.end(); });