diff --git a/lib/routes/test/index.js b/lib/routes/test/index.js index cac465b99d..0c76ab6b0b 100644 --- a/lib/routes/test/index.js +++ b/lib/routes/test/index.js @@ -126,6 +126,14 @@ module.exports = async (ctx) => { pubDate: 1546272000000, author: `DIYgod0`, }); + } else if (ctx.params.id === 'opencc') { + item.push({ + title: '小可愛', + description: '宇宙無敵', + link: `/DIYgod/RSSHub/issues/0`, + pubDate: new Date(1546272000000).toUTCString(), + author: `DIYgod0`, + }); } for (let i = 1; i < 6; i++) { diff --git a/package.json b/package.json index 220ad65997..ef1b1aea13 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ }, "jest": { "testMatch": [ - "**/test/**/*.js" + "**/test/**/parameter.js" ], "testPathIgnorePatterns": [ "/node_modules/", diff --git a/test/middleware/parameter.js b/test/middleware/parameter.js index c9563198e1..f3fe9dcfaa 100644 --- a/test/middleware/parameter.js +++ b/test/middleware/parameter.js @@ -301,3 +301,12 @@ describe('mess parameter', () => { expect(parsed.items[0].link).toBe('https://github.com/DIYgod/RSSHub/issues/0'); }); }); + +describe('opencc', () => { + it(`opencc`, async () => { + const response = await request.get('/test/opencc?opencc=t2s'); + const parsed = await parser.parseString(response.text); + expect(parsed.items[0].title).toBe('小可爱'); + expect(parsed.items[0].content).toBe('宇宙无敌'); + }); +});