test: opencc

This commit is contained in:
DIYgod
2020-09-25 01:43:59 +08:00
parent 52398423e9
commit ed4725fa48
3 changed files with 18 additions and 1 deletions

View File

@@ -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++) {

View File

@@ -117,7 +117,7 @@
},
"jest": {
"testMatch": [
"**/test/**/*.js"
"**/test/**/parameter.js"
],
"testPathIgnorePatterns": [
"/node_modules/",

View File

@@ -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('宇宙无敌');
});
});