mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
test: fix wechat-mp test
This commit is contained in:
@@ -32,6 +32,21 @@ const server = setupServer(
|
||||
</li>
|
||||
</ul>
|
||||
</div>`)
|
||||
),
|
||||
http.get(`https://mp.weixin.qq.com/rsshub_test/wechatMp_fetchArticle`, () =>
|
||||
HttpResponse.text(
|
||||
'\n' +
|
||||
'<meta name="description" content="summary" />\n' +
|
||||
'<meta name="author" content="author" />\n' +
|
||||
'<meta property="og:title" content="title" />\n' +
|
||||
'<meta property="twitter:card" content="summary" />\n' +
|
||||
'<div class="rich_media_content" id="js_content" style="visibility: hidden;">description</div>\n' +
|
||||
'<div class="profile_inner"><strong class="profile_nickname">mpName</strong></div>\n' +
|
||||
'<script type="text/javascript" nonce="000000000">\n' +
|
||||
'var appmsg_type = "9";\n' +
|
||||
`var ct = "${1_636_626_300}";\n` +
|
||||
'</script>'
|
||||
)
|
||||
)
|
||||
);
|
||||
server.listen();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { load } from 'cheerio';
|
||||
import nock from 'nock';
|
||||
import { fixArticleContent, fetchArticle, finishArticleItem, normalizeUrl } from '@/utils/wechat-mp';
|
||||
|
||||
// date from the cache will be an ISO8601 string, so we need to use this function
|
||||
@@ -91,22 +90,6 @@ describe('wechat-mp', () => {
|
||||
|
||||
it('fetchArticle_&_finishArticleItem', async () => {
|
||||
const ct = 1_636_626_300;
|
||||
const exampleMpArticlePage =
|
||||
'\n' +
|
||||
'<meta name="description" content="summary" />\n' +
|
||||
'<meta name="author" content="author" />\n' +
|
||||
'<meta property="og:title" content="title" />\n' +
|
||||
'<meta property="twitter:card" content="summary" />\n' +
|
||||
'<div class="rich_media_content" id="js_content" style="visibility: hidden;">description</div>\n' +
|
||||
'<div class="profile_inner"><strong class="profile_nickname">mpName</strong></div>\n' +
|
||||
'<script type="text/javascript" nonce="000000000">\n' +
|
||||
'var appmsg_type = "9";\n' +
|
||||
`var ct = "${ct}";\n` +
|
||||
'</script>';
|
||||
|
||||
nock('https://mp.weixin.qq.com')
|
||||
.get('/rsshub_test/wechatMp_fetchArticle')
|
||||
.reply(() => [200, exampleMpArticlePage]);
|
||||
const httpsUrl = 'https://mp.weixin.qq.com/rsshub_test/wechatMp_fetchArticle';
|
||||
const httpUrl = httpsUrl.replace(/^https:\/\//, 'http://');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user