Skip to content

Commit

Permalink
wip: stringify: failing tests for arrayFormat comma
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 19, 2021
1 parent e2fd364 commit 5189d2f
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions test/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ test('stringify()', function (t) {
);
st.equal(
qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'comma' }),
'a=b%2Cc%2Cd',
'a=b,c,d',
'comma => comma'
);
st.equal(
Expand Down Expand Up @@ -134,8 +134,7 @@ test('stringify()', function (t) {
t.test('stringifies a nested array value', function (st) {
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[b][0]=c&a[b][1]=d');
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[b][]=c&a[b][]=d');
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a[b]=c%2Cd');
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a[b]=c,d', '(pending issue #378)', { skip: true });
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a[b]=c,d');
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true }), 'a[b][0]=c&a[b][1]=d');
st.end();
});
Expand All @@ -157,22 +156,13 @@ test('stringify()', function (t) {
'a.b[]=c&a.b[]=d',
'brackets: stringifies with dots + brackets'
);
st.equal(
qs.stringify(
{ a: { b: ['c', 'd'] } },
{ allowDots: true, encodeValuesOnly: true, arrayFormat: 'comma' }
),
'a.b=c%2Cd',
'comma: stringifies with dots + comma'
);
st.equal(
qs.stringify(
{ a: { b: ['c', 'd'] } },
{ allowDots: true, encodeValuesOnly: true, arrayFormat: 'comma' }
),
'a.b=c,d',
'comma: stringifies with dots + comma (pending issue #378)',
{ skip: true }
'comma: stringifies with dots + comma'
);
st.equal(
qs.stringify(
Expand Down Expand Up @@ -237,8 +227,7 @@ test('stringify()', function (t) {
st.equal(
qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true, arrayFormat: 'comma' }),
'???',
'brackets => brackets (pending issue #378)',
{ skip: true }
'brackets => brackets'
);
st.equal(
qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true }),
Expand Down Expand Up @@ -845,7 +834,7 @@ test('stringify()', function (t) {
st.equal(qs.stringify(withArray, { encode: false }), 'a[b][0][c]=d&a[b][0][e]=f', 'array, no arrayFormat');
st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'bracket' }), 'a[b][0][c]=d&a[b][0][e]=f', 'array, bracket');
st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'indices' }), 'a[b][0][c]=d&a[b][0][e]=f', 'array, indices');
st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'comma' }), '???', 'array, comma (pending issue #378)', { skip: true });
st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'comma' }), '???', 'array, comma');

st.end();
});
Expand Down

0 comments on commit 5189d2f

Please sign in to comment.