Skip to content

Commit 7cda957

Browse files
committed
Add unit test for handling null and empty strings in arrayFormat: 'comma'
1 parent 27453b5 commit 7cda957

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/stringify.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ test('array stringify representation with array commas', t => {
126126
}), 'bar=one,two&foo');
127127
});
128128

129+
test('array stringify representation with array commas and null/empty values', t => {
130+
const result = queryString.stringify({
131+
list: ['item', null, 'last', '']
132+
}, {
133+
arrayFormat: 'comma',
134+
skipNull: false,
135+
skipEmptyString: false
136+
});
137+
138+
t.is(result, 'list=item,,last,');
139+
});
140+
129141
test('array stringify representation with array commas and null value', t => {
130142
t.is(queryString.stringify({
131143
foo: [null, 'a', null, ''],

0 commit comments

Comments
 (0)