Skip to content

Commit

Permalink
test: opencc
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Sep 24, 2020
1 parent 5239842 commit ed4725f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/routes/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
},
"jest": {
"testMatch": [
"**/test/**/*.js"
"**/test/**/parameter.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
Expand Down
9 changes: 9 additions & 0 deletions test/middleware/parameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('宇宙无敌');
});
});

0 comments on commit ed4725f

Please sign in to comment.