diff --git a/__tests__/lib/idea-plan-parser.test.ts b/__tests__/lib/idea-plan-parser.test.ts index 30169aa..c279ea8 100644 --- a/__tests__/lib/idea-plan-parser.test.ts +++ b/__tests__/lib/idea-plan-parser.test.ts @@ -62,6 +62,41 @@ body } }) + it('hints when markdown sneaks into frontmatter', () => { + // "1. **...**: [unclosed" triggers a YAMLParseError at the markdown line + // (plain-list-with-bold parses as valid YAML without an unclosed flow) + const broken = `--- +pbi: + title: Test + priority: 2 +stories: +1. **Toggle zichtbaar in productie**: [unclosed +--- + +body +` + const r = parsePlanMd(broken) + expect(r.ok).toBe(false) + if (!r.ok) { + expect(r.errors[0].hint).toMatch(/markdown/i) + expect(r.errors[0].line).toBeGreaterThan(1) + } + }) + + it('omits hint for non-markdown yaml errors', () => { + const broken = `--- +pbi: + title: Test + priority: [unclosed +stories: + - foo +--- +` + const r = parsePlanMd(broken) + expect(r.ok).toBe(false) + if (!r.ok) expect(r.errors[0].hint).toBeUndefined() + }) + it('reports schema-validation error when pbi-section missing', () => { const noPbi = `--- stories: