Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update marked tests
Steven749486ba3c9a
diff --git a/web/src/labs/marked/marked.test.ts b/web/src/labs/marked/marked.test.tsindex cf7f9afb5..1dd0fda57 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: `<p>text above the table</p>-<table>- <thead>- <tr>- <th>a</th><th>b</th><th>c</th>- </tr>- </thead>- <tbody>- <tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr>- </tbody>-</table>-<p>text below the table</p>-`,- },- {- markdown: `| a | b | c |-| 1 | 2 | 3 |-| 4 | 5 | 6 |`,- want: `<p>| a | b | c |</p>-<p>| 1 | 2 | 3 |</p>-<p>| 4 | 5 | 6 |</p>`,- },- ];- 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: `<p>text above the table</p>+<table>+ <thead>+ <tr>+ <th>a</th><th>b</th><th>c</th>+ </tr>+ </thead>+ <tbody>+ <tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr>+ </tbody>+</table>+<p>text below the table</p>+`,+ },+ {+ markdown: `| a | b | c |+| 1 | 2 | 3 |+| 4 | 5 | 6 |`,+ want: `<p>| a | b | c |</p>+<p>| 1 | 2 | 3 |</p>+<p>| 4 | 5 | 6 |</p>`,+ },+ ];+ for (const t of tests) {+ expect(unescape(marked(t.markdown))).toBe(t.want);+ }+ });});