From fc8404afd5d353647a2a2892193360c638fe286c Mon Sep 17 00:00:00 2001 From: Scrum4Me Agent <30029041+madhura68@users.noreply.github.com> Date: Fri, 8 May 2026 12:49:41 +0200 Subject: [PATCH] ST-cmowjewfg: Test: parser geeft hint bij markdown-in-frontmatter Voeg twee Vitest-cases toe: - hints when markdown sneaks into frontmatter: fixture met [unclosed op een genummerde markdown-regel triggert YAMLParseError op die regel (plain lijst zonder unclosed flow parset als geldig YAML) - omits hint for non-markdown yaml errors: unclosed bracket zonder markdown-patroon geeft geen hint --- __tests__/lib/idea-plan-parser.test.ts | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) 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: