Skip to content

Commit

Permalink
[Tests] stringify: increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 29, 2024
1 parent e679e12 commit 1e04701
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down

0 comments on commit 1e04701

Please sign in to comment.