fix(decoder): use default delimiter for parsing array headers

This commit is contained in:
Johann Schopplich
2025-10-29 13:43:05 +01:00
parent ee31be3bdc
commit 6040c018e0
2 changed files with 9 additions and 1 deletions

View File

@@ -366,6 +366,14 @@ describe('delimiter options', () => {
expect(decode(toon)).toEqual({ pairs: [['a', 'b'], ['c', 'd']] })
})
it.each([
{ parent: '[1\t]', nested: '[3]', values: 'a,b,c' },
{ parent: '[1|]', nested: '[3]', values: 'a,b,c' },
])('nested arrays inside list items default to comma delimiter', ({ parent, nested, values }) => {
const toon = `items${parent}:\n - tags${nested}: ${values}`
expect(decode(toon)).toEqual({ items: [{ tags: ['a', 'b', 'c'] }] })
})
it.each([
{ header: '[3\t]', joined: 'x\ty\tz' },
{ header: '[3|]', joined: 'x|y|z' },