From 02804fe09ee629e605187b8298e3176f55bed963 Mon Sep 17 00:00:00 2001 From: Fuxing Loh Date: Thu, 28 Sep 2023 19:18:37 +0800 Subject: [PATCH] chore(contented): add more test coverage --- .../fixtures/Features.md | 14 ++++++++++++++ .../src/MarkdownPipeline.unit.ts | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 packages/contented-pipeline-md/fixtures/Features.md diff --git a/packages/contented-pipeline-md/fixtures/Features.md b/packages/contented-pipeline-md/fixtures/Features.md new file mode 100644 index 00000000..9c42aa2e --- /dev/null +++ b/packages/contented-pipeline-md/fixtures/Features.md @@ -0,0 +1,14 @@ +--- +title: 'Title Override' +description: 'Description Override' +--- + +# Features + +```mermaid +graph TD; + A-->B; + A-->C; + B-->D; + C-->D; +``` diff --git a/packages/contented-pipeline-md/src/MarkdownPipeline.unit.ts b/packages/contented-pipeline-md/src/MarkdownPipeline.unit.ts index 22530cc5..2ac15ba5 100644 --- a/packages/contented-pipeline-md/src/MarkdownPipeline.unit.ts +++ b/packages/contented-pipeline-md/src/MarkdownPipeline.unit.ts @@ -75,4 +75,23 @@ describe('Without Config', () => { }, ]); }); + + it('should process Features.md', async () => { + const content = await pipeline.process(rootPath, 'Features.md'); + expect(content).toStrictEqual([ + { + type: 'Markdown', + fields: { + description: 'Description Override', + title: 'Title Override', + }, + headings: expect.any(Array), + path: '/features', + sections: [], + fileId: expect.stringMatching(/[0-f]{64}/), + modifiedDate: expect.any(Number), + html: '

Features

\n
graph TD;\n A-->B;\n A-->C;\n B-->D;\n C-->D;\n
', + }, + ]); + }); });