Skip to content

Commit

Permalink
Update test snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranparajuli589 committed Oct 23, 2023
1 parent d9c8d39 commit 8baa9c5
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 3,028 deletions.
2,871 changes: 30 additions & 2,841 deletions tests/integration/__snapshots__/large.spec.js.snap

Large diffs are not rendered by default.

26 changes: 1 addition & 25 deletions tests/integration/__snapshots__/small.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,7 @@

exports[`Small MD To HTML should parse the small markdown file content to html 1`] = `
"<!-- https://regex101.com/r/C6SxZH/1--><h1>Heading One <code>CODE INSIDE</code></h1><h2>Heading Two</h2><h3>Heading Three</h3><h4>Heading Four</h4><h5>Heading Five</h5><h6>Heading Six</h6><p>a paragraph of words <code>first code</code> normal text here <code>code body</code> <em>first italics</em> here me crying <em>italic body</em> here me crying <strong>first bolds</strong> some normal again <strong>bold body</strong> <a href=\\"https://kiranparajuli.com.np\\">Kiran Parajuli</a> <s>strikes body</s> here some normal again at the last</p><blockquote>
<p> some quote with <u>Underline</u></p></blockquote><ul>
<li>list item 1</li>
<li>list item 2</li>
</ul><ul>
<li>list item 3</li>
<li>list item 4</li>
</ul><ul>
<li>list item 5</li>
<li>list item 6</li>
</ul><ul>
<li><input type='checkbox'>checkbox empty</li>
<li><input type='checkbox' checked>checkbox checked</li>
</ul><ul>
<li><input type='checkbox'>checkbox empty</li>
<li><input type='checkbox' checked>checkbox checked</li>
</ul><ul>
<li><input type='checkbox'>checkbox empty</li>
<li><input type='checkbox' checked>checkbox checked</li>
</ul><ol>
<li>numbered list item 1</li>
<li>numbered list item 2</li>
</ol><ol>
<li><input type='checkbox'>numbered checkbox empty</li>
<li><input type='checkbox' checked>numbered checkbox checked paragraph just below hmm, but with some fun :)</li>
</ol><blockquote>
<p> some quote with <u>Underline</u></p></blockquote><ul><li>list item 1</li><li>list item 2</li></ul><ul><li>list item 3</li><li>list item 4</li></ul><ul><li>list item 5</li><li>list item 6</li></ul><ul><li><input type='checkbox'>checkbox empty</li><li><input type='checkbox' checked>checkbox checked</li></ul><ul><li><input type='checkbox'>checkbox empty</li><li><input type='checkbox' checked>checkbox checked</li></ul><ul><li><input type='checkbox'>checkbox empty</li><li><input type='checkbox' checked>checkbox checked</li></ul><ol><li>numbered list item 1</li><li>numbered list item 2</li></ol><ol><li><input type='checkbox'>numbered checkbox empty</li><li><input type='checkbox' checked>numbered checkbox checked paragraph just below hmm, but with some fun :)</li></ol><blockquote>
<p> quote 1</p><blockquote>
<p> nested quote 2 <a href=\\"quote-link-url\\">quote-link</a></p><blockquote>
<p> nested quote 3 with <em>italics</em> and <strong>bolds</strong></p></blockquote></blockquote></blockquote><pre><code class='language-js'>const a = 1;
Expand Down
1 change: 0 additions & 1 deletion tests/integration/large.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ describe("Large MD To HTML", () => {
it.each([
// eslint-disable-next-line no-undef
File.pathJoin(__dirname, "..", "fixtures/large_markdown.md"),

Check failure on line 13 in tests/integration/large.spec.js

View workflow job for this annotation

GitHub Actions / build

Unexpected trailing comma
File.pathJoin(__dirname, "..", "fixtures/markdownit.md")
])("should parse the large markdown file content to html", (path) => {
const html = mdp.parse(File.read(path))
expect(html).toMatchSnapshot()
Expand Down
76 changes: 8 additions & 68 deletions tests/unit/lexer/__snapshots__/codeblock.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -147,76 +147,16 @@ Array [
"indent": 2,
"language": "markdown",
"raw": " \`\`\` markdown
1. one",
"type": "code-block",
"value": "1. one",
},
Object {
"type": "new-line",
},
Object {
"indent": 2,
"items": Array [
Object {
"checked": null,
"count": "2",
"raw": " 2. two",
"tokens": Array [
Object {
"indent": 0,
"raw": "two",
"tokens": Array [
Object {
"raw": "two",
"type": "text",
"value": "two",
},
],
"type": "paragraph",
"value": "two",
},
],
"type": "list-item",
},
Object {
"checked": null,
"count": "3",
"raw": " 3. three
\`\`\`",
"tokens": Array [
Object {
"indent": 0,
"raw": "three",
"tokens": Array [
Object {
"raw": "three",
"type": "text",
"value": "three",
},
],
"type": "paragraph",
"value": "three",
},
Object {
"indent": 2,
"language": null,
"raw": " \`\`\`",
"type": "code-block",
"value": "",
},
],
"type": "list-item",
},
],
"meta": Object {
"checklist": false,
"identifier": null,
"ordered": true,
},
"raw": " 2. two
1. one
2. two
3. three
\`\`\`",
"type": "list",
"type": "code-block",
"value": "1. one
2. two
3. three",
},
],
"type": "list-item",
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/parser/__snapshots__/codeblock.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
exports[`CodeBlock Parsing should cope with multiple items 1`] = `"<pre><code class='language-js'>const a = 1</code></pre><p>some people are funny</p>"`;

exports[`CodeBlock Parsing should parse indent codeblock 1`] = `
"<p>This is a normal paragraph:</p><pre><code>This is a code block.</code></pre><p>Here is an example of AppleScript:</p><pre><code>tell application &quot;Foo&quot;
"<p>This is a normal paragraph:</p><pre><code>This is a code block.
</code></pre><p>Here is an example of AppleScript:</p><pre><code>tell application &quot;Foo&quot;
beep
end tell</code></pre><p>A code block continues until it reaches a line that is not indented (or the end of the article).</p>"
end tell
</code></pre><p>A code block continues until it reaches a line that is not indented (or the end of the article).</p>"
`;

exports[`CodeBlock Parsing should parse multiple consequetive codeblocks 1`] = `"<pre><code class='language-js'>const a = 1</code></pre><pre><code class='language-js'>const b = 2</code></pre>"`;
Expand Down
92 changes: 12 additions & 80 deletions tests/unit/parser/__snapshots__/list.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,95 +1,27 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`List Parsing indent should break the list 1`] = `
"<ul>
<li>item <strong>1</strong></li>
<li>item <a href=\\"link-url\\">link</a><ul>
<li>item 3 <code>code item</code><ul>
<li>item 4</li>
</ul></li>
<li>item 3 <code>code item</code></li>
</ul></li>
</ul>"
`;
exports[`List Parsing indent should break the list 1`] = `"<ul><li>item <strong>1</strong></li><li>item <a href=\\"link-url\\">link</a><ul><li>item 3 <code>code item</code><ul><li>item 4</li></ul></li><li>item 3 <code>code item</code></li></ul></li></ul>"`;
exports[`List Parsing should allow empty list item 1`] = `
"<h2>- one</h2><ul>
<li>two</li>
</ul>"
`;
exports[`List Parsing should allow empty list item 1`] = `"<h2>- one</h2><ul><li>two</li></ul>"`;
exports[`List Parsing should detect list indent 1`] = `
"<ul>
<li>item <strong>1</strong></li>
<li>item <a href=\\"link-url\\">link</a></li>
<li>item 3 <code>code item</code></li>
</ul>"
`;
exports[`List Parsing should detect list indent 1`] = `"<ul><li>item <strong>1</strong></li><li>item <a href=\\"link-url\\">link</a></li><li>item 3 <code>code item</code></li></ul>"`;
exports[`List Parsing should parse a list with an empty list item 1`] = `
"<h2>- one</h2><ul>
<li>two</li>
</ul>"
`;
exports[`List Parsing should parse a list with an empty list item 1`] = `"<h2>- one</h2><ul><li>two</li></ul>"`;
exports[`List Parsing should parse a list with an empty list item 2`] = `
"<ul>
<li></li>
<li>one</li>
<li>two</li>
</ul>"
`;
exports[`List Parsing should parse a list with an empty list item 2`] = `"<ul><li></li><li>one</li><li>two</li></ul>"`;
exports[`List Parsing should parse a list with an empty list item 3`] = `
"<ul>
<li>one</li>
</ul><h2>- two</h2>"
`;
exports[`List Parsing should parse a list with an empty list item 3`] = `"<ul><li>one</li></ul><h2>- two</h2>"`;
exports[`List Parsing should parse a spaced list 1`] = `
"<ul>
<li>here we go with a list item</li>
<li>another list item is here</li>
<li>next list item is on the fly</li>
</ul>"
`;
exports[`List Parsing should parse a spaced list 1`] = `"<ul><li>here we go with a list item</li><li>another list item is here</li><li>next list item is on the fly</li></ul>"`;
exports[`List Parsing should parse the indented codeblock inside 1`] = `
"<p>To put a code block within a list item, the code block needs to be indented <em>twice</em> -- 8 spaces or two tabs:</p><ul>
<li>A list item with a code block:<pre><code>&lt;code goes here&gt;
"<p>To put a code block within a list item, the code block needs to be indented <em>twice</em> -- 8 spaces or two tabs:</p><ul><li>A list item with a code block:<pre><code>&lt;code goes here&gt;
&lt;code goes here&gt;
&lt;code goes here&gt;</code></pre></li>
</ul><h3>Code Blocks</h3>"
&lt;code goes here&gt;</code></pre></li></ul><h3>Code Blocks</h3>"
`;
exports[`List Parsing should tokenize a valid ordered list 1`] = `
"<ol>
<li>item <strong>1</strong></li>
<li>item <a href=\\"link-url\\">link</a></li>
<li>item 3 <code>code item</code></li>
</ol>"
`;
exports[`List Parsing should tokenize a valid ordered list 1`] = `"<ol><li>item <strong>1</strong></li><li>item <a href=\\"link-url\\">link</a></li><li>item 3 <code>code item</code></li></ol>"`;
exports[`List Parsing should tokenize a valid un-ordered list 1`] = `
"<ul>
<li>item <strong>1</strong></li>
<li>item <a href=\\"link-url\\">link</a></li>
<li>item 3 <code>code item</code></li>
</ul>"
`;
exports[`List Parsing should tokenize a valid un-ordered list 1`] = `"<ul><li>item <strong>1</strong></li><li>item <a href=\\"link-url\\">link</a></li><li>item 3 <code>code item</code></li></ul>"`;
exports[`List Parsing should tokenize list combination 1`] = `
"<ul>
<li>one</li>
<li>two</li>
</ul><ol>
<li>one</li>
<li>two</li>
</ol><ul>
<li><input type='checkbox'>c empty</li>
<li><input type='checkbox' checked>c checked</li>
</ul><ol>
<li><input type='checkbox'>c empty</li>
<li><input type='checkbox' checked>c checked</li>
</ol>"
`;
exports[`List Parsing should tokenize list combination 1`] = `"<ul><li>one</li><li>two</li></ul><ol><li>one</li><li>two</li></ol><ul><li><input type='checkbox'>c empty</li><li><input type='checkbox' checked>c checked</li></ul><ol><li><input type='checkbox'>c empty</li><li><input type='checkbox' checked>c checked</li></ol>"`;
4 changes: 1 addition & 3 deletions tests/unit/parser/__snapshots__/parser.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ exports[`Parser Commons common tokens should parse the common tokens with some s
exports[`Parser Commons common tokens should parse underlined heading 1`] = `"<h1>Heading 1</h1><h2>Heading 2</h2><p>Normal text</p>"`;
exports[`Parser Commons escaping should escape everything excepts tags for other tokens 1`] = `
"<h1>&amp;Ampersand</h1><ul>
<li>&#39;SomeQuote&#39;</li>
</ul><blockquote>
"<h1>&amp;Ampersand</h1><ul><li>&#39;SomeQuote&#39;</li></ul><blockquote>
<p> Some &quot; comment</p><bold>bold</bold></blockquote>"
`;
Expand Down
10 changes: 2 additions & 8 deletions tests/unit/parser/__snapshots__/quote.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ exports[`Quote Parsing should detect the circular quote 1`] = `
exports[`Quote Parsing should find the list and codeblock inside 1`] = `
"<blockquote>
<h2>This is a header.</h2><ol>
<li>This is the first list item.</li>
<li>This is the second list item.</li>
</ol><p> Here&#39;s some example code:</p><pre><code>return shell_exec(&quot;echo $input | $markdown_script&quot;);</code></pre></blockquote>"
<h2>This is a header.</h2><ol><li>This is the first list item.</li><li>This is the second list item.</li></ol><p> Here&#39;s some example code:</p><pre><code>return shell_exec(&quot;echo $input | $markdown_script&quot;);</code></pre></blockquote>"
`;
exports[`Quote Parsing should parse multiline quote with the same depth and indent 1`] = `
Expand All @@ -79,8 +76,5 @@ exports[`Quote Parsing should parse multiline quote with the same depth and inde
exports[`Quote Parsing should parse the quote with list inside 1`] = `
"<blockquote>
<ul>
<li>one</li>
<li>two</li>
</ul></blockquote>"
<ul><li>one</li><li>two</li></ul></blockquote>"
`;

0 comments on commit 8baa9c5

Please sign in to comment.