test: reorganize validation and error handling tests

This commit is contained in:
Johann Schopplich
2025-10-29 14:59:36 +01:00
parent 8d5e3c9758
commit df51ab0a1f

View File

@@ -473,7 +473,8 @@ describe('length marker option', () => {
}) })
}) })
describe('error handling', () => { describe('validation and error handling', () => {
describe('length and structure errors', () => {
it('throws on array length mismatch (inline primitives)', () => { it('throws on array length mismatch (inline primitives)', () => {
const toon = 'tags[2]: a,b,c' const toon = 'tags[2]: a,b,c'
expect(() => decode(toon)).toThrow() expect(() => decode(toon)).toThrow()
@@ -603,8 +604,8 @@ describe('strict mode: indentation validation', () => {
}) })
}) })
describe('blank lines in arrays', () => { describe('strict mode: blank lines in arrays', () => {
describe('strict mode: errors on blank lines inside arrays', () => { describe('errors on blank lines inside arrays', () => {
it('throws on blank line inside list array', () => { it('throws on blank line inside list array', () => {
const teon = 'items[3]:\n - a\n\n - b\n - c' const teon = 'items[3]:\n - a\n\n - b\n - c'
expect(() => decode(teon)).toThrow(/blank line/i) expect(() => decode(teon)).toThrow(/blank line/i)
@@ -682,3 +683,4 @@ describe('blank lines in arrays', () => {
}) })
}) })
}) })
})