diff --git a/web/src/labs/marked/marked.test.ts b/web/src/labs/marked/marked.test.ts index cf7f9afb..1dd0fda5 100644 --- a/web/src/labs/marked/marked.test.ts +++ b/web/src/labs/marked/marked.test.ts @@ -3,44 +3,6 @@ import { unescape } from "lodash-es"; import { marked } from "."; describe("test marked parser", () => { - test("test markdown table", () => { - const tests = [ - { - markdown: `text above the table -| a | b | c | -|---|---|---| -| 1 | 2 | 3 | -| 4 | 5 | 6 | -text below the table -`, - want: `
text above the table
-a | b | c | -
---|---|---|
1 | 2 | 3 |
4 | 5 | 6 |
text below the table
-`, - }, - { - markdown: `| a | b | c | -| 1 | 2 | 3 | -| 4 | 5 | 6 |`, - want: `| a | b | c |
-| 1 | 2 | 3 |
-| 4 | 5 | 6 |
`, - }, - ]; - for (const t of tests) { - expect(unescape(marked(t.markdown))).toBe(t.want); - } - }); - test("parse code block", () => { const tests = [ { @@ -159,4 +121,41 @@ console.log("hello world!") expect(unescape(marked(t.markdown))).toBe(t.want); } }); + test("parse table", () => { + const tests = [ + { + markdown: `text above the table +| a | b | c | +|---|---|---| +| 1 | 2 | 3 | +| 4 | 5 | 6 | +text below the table +`, + want: `text above the table
+a | b | c | +
---|---|---|
1 | 2 | 3 |
4 | 5 | 6 |
text below the table
+`, + }, + { + markdown: `| a | b | c | +| 1 | 2 | 3 | +| 4 | 5 | 6 |`, + want: `| a | b | c |
+| 1 | 2 | 3 |
+| 4 | 5 | 6 |
`, + }, + ]; + for (const t of tests) { + expect(unescape(marked(t.markdown))).toBe(t.want); + } + }); });