Skip to content

Commit dd45971

Browse files
committed
tests: validate html-to-md output
To test this, we simply use the current tip entry of the commits feed of this project's repository itself. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent b435026 commit dd45971

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

__tests__/index.test.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,53 @@ test('handles feed entries without titles', async () => {
7171
body: 'TBD\n'
7272
})
7373
})
74+
75+
test('html to markdown conversion', async () => {
76+
const date = new Date().toISOString()
77+
mockHTTPSGet.__RETURN__ = `<?xml version="1.0" encoding="UTF-8"?>
78+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
79+
<id>tag:github.com,2008:/git-for-windows/rss-to-issues/commits/main</id>
80+
<link type="text/html" rel="alternate" href="https://github.com/git-for-windows/rss-to-issues/commits/main"/>
81+
<link type="application/atom+xml" rel="self" href="https://github.com/git-for-windows/rss-to-issues/commits/main.atom"/>
82+
<title>Recent Commits to rss-to-issues:main</title>
83+
<updated>${date}</updated>
84+
<entry>
85+
<id>tag:github.com,2008:Grit::Commit/394ee852b18c5e3bca536b585cbb95d32ce77057</id>
86+
<link type="text/html" rel="alternate" href="https://github.com/git-for-windows/rss-to-issues/commit/394ee852b18c5e3bca536b585cbb95d32ce77057"/>
87+
<title>
88+
ci(release-tags): use newer versions of Actions
89+
</title>
90+
<updated>${date}</updated>
91+
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/127790?s=30&amp;v=4"/>
92+
<author>
93+
<name>dscho</name>
94+
<uri>https://github.com/dscho</uri>
95+
</author>
96+
<content type="html">
97+
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;ci(release-tags): use newer versions of Actions
98+
99+
This avoids warnings about node.js/set-output deprecations.
100+
101+
Signed-off-by: Johannes Schindelin &amp;lt;johannes.schindelin@gmx.de&amp;gt;&lt;/pre&gt;
102+
</content>
103+
</entry>
104+
</feed>
105+
`
106+
octokit.issues.listForRepo.mockReturnValueOnce({ data: [] })
107+
await run()
108+
109+
expect(octokit.issues.create).toBeCalledWith({
110+
owner: 'owner',
111+
repo: 'repo',
112+
title: 'ci(release-tags): use newer versions of Actions',
113+
body: `\`\`\`
114+
ci(release-tags): use newer versions of Actions
115+
116+
This avoids warnings about node.js/set-output deprecations.
117+
118+
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
119+
\`\`\`
120+
121+
https://github.com/git-for-windows/rss-to-issues/commit/394ee852b18c5e3bca536b585cbb95d32ce77057`
122+
})
123+
})

0 commit comments

Comments
 (0)