From 48afef7db732347e90eac34b2025255e4737fa40 Mon Sep 17 00:00:00 2001 From: shmck Date: Sat, 30 May 2020 15:23:47 -0700 Subject: [PATCH] test double line breaks Signed-off-by: shmck --- tests/parse.test.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/parse.test.ts b/tests/parse.test.ts index 736f8b2..ff595bc 100644 --- a/tests/parse.test.ts +++ b/tests/parse.test.ts @@ -144,4 +144,41 @@ levels: }; expect(result.levels[0].summary).toMatch(/\.\.\.$/); }); + + it("should match line breaks with double line breaks for proper spacing", () => { + const md = `# Title + +Description. + +Second description line + +## L1 Titles + +First line + +Second line + +Third line +`; + + const yaml = `version: "0.1.0" +levels: +- id: L1 +`; + const result = parse(md, yaml); + const expected = { + summary: { + description: "Description.\n\nSecond description line", + }, + levels: [ + { + id: "L1", + summary: "Some text that becomes the summary", + content: "First line\n\nSecond line\n\nThird line", + }, + ], + }; + expect(result.summary.description).toBe(expected.summary.description); + expect(result.levels[0].content).toBe(expected.levels[0].content); + }); });