From 3016a2f44fe2bd01857e18b2892415eb82f57cff Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 27 Mar 2024 14:53:43 +0800 Subject: [PATCH] test: fix wechat-mp test --- lib/setup.test.ts | 15 +++++++++++++++ lib/utils/wechat-mp.test.ts | 17 ----------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/setup.test.ts b/lib/setup.test.ts index df52b0f67..a3120aca6 100644 --- a/lib/setup.test.ts +++ b/lib/setup.test.ts @@ -32,6 +32,21 @@ const server = setupServer( `) + ), + http.get(`https://mp.weixin.qq.com/rsshub_test/wechatMp_fetchArticle`, () => + HttpResponse.text( + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '
mpName
\n' + + '' + ) ) ); server.listen(); diff --git a/lib/utils/wechat-mp.test.ts b/lib/utils/wechat-mp.test.ts index b4811e84c..e700a6e42 100644 --- a/lib/utils/wechat-mp.test.ts +++ b/lib/utils/wechat-mp.test.ts @@ -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' + - '\n' + - '\n' + - '\n' + - '\n' + - '\n' + - '
mpName
\n' + - ''; - - 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://');