Skip to content

Commit

Permalink
Add more test.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Nov 16, 2023
1 parent 734f15b commit 4588a43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion feishu-docx/tests/fixtures/case3.expect.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ yarn feishu-pages
<div>
<img src="SzJmbprNwo5Y7Cx2MzAc7k7dnCt" src-width="2532" src-height="1480" align="center"/>
<p><a href="https://twitter.com/WaytoAGI">欢迎订阅我们的 X &lt;Twitter&gt;</a></p>
<p><a href="https://twitter.com/WaytoAGI">欢迎订阅我们的 X &lt;Twitter&gt;<br/>https://twitter.com/xxx</a></p>
<p>最新知识库精选同步</p>
</div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion feishu-docx/tests/fixtures/case3.raw.json
Original file line number Diff line number Diff line change
Expand Up @@ -3444,7 +3444,7 @@
"elements": [
{
"text_run": {
"content": "欢迎订阅我们的 X <Twitter>",
"content": "欢迎订阅我们的 X <Twitter>\nhttps://twitter.com/xxx",
"text_element_style": {
"bold": false,
"comment_ids": [
Expand Down
7 changes: 6 additions & 1 deletion feishu-docx/tests/markdown_renderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ describe('MarkdownRenderer', () => {
});

test('markdownToHTML', () => {
let raw = `<img src="/feishu-pages/assets/TGgab0uVmo6rumxnH7RcMEuHnLf.png" src-width="576" src-height="128" align="center">[This is a Link](https://github.com) this is suffix.`;
let render = new MarkdownRenderer({});

let raw = `<img src="/feishu-pages/assets/TGgab0uVmo6rumxnH7RcMEuHnLf.png" src-width="576" src-height="128" align="center">[This is a Link](https://github.com) this is suffix.`;
let result = render.markdownToHTML(raw);
let expect = `<p><img src="/feishu-pages/assets/TGgab0uVmo6rumxnH7RcMEuHnLf.png" src-width="576" src-height="128" align="center"><a href="https://github.com">This is a Link</a> this is suffix.</p>\n`;
assert.equal(result, expect);
Expand All @@ -95,6 +96,10 @@ describe('MarkdownRenderer', () => {
result = render.markdownToHTML(raw);
expect = `<div><img src="/feishu-pages/assets/TGgab0uVmo6rumxnH7RcMEuHnLf.png" src-width="576" src-height="128" align="center"></div>\n\n<p><a href="https://github.com">This is a Link</a><br/>This is suffix.</p>\n`;
assert.equal(result, expect);

raw = `> This is first line.\n> This is second line.`;
result = render.markdownToHTML(raw);
expect = `<blockquote>\n<p>This is first line.<br/>This is second line.</p>\n</blockquote>\n`;
});

test('escapeHTMLTags', () => {
Expand Down

0 comments on commit 4588a43

Please sign in to comment.