Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use sanitize-html #14312

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: add brief test
  • Loading branch information
TonyRL committed Jan 23, 2024
commit 6da8024c2f89ef11d8ec19b6e6dec098a66733bd
11 changes: 11 additions & 0 deletions lib/v2/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@ module.exports = async (ctx) => {

break;

case 'brief':
item.push({
title: '小可愛',
description: '<p>宇宙無敵</p><br>'.repeat(1000),
link: `/DIYgod/RSSHub/issues/0`,
pubDate: new Date(1_546_272_000_000).toUTCString(),
author: `DIYgod0`,
});

break;

case 'json':
item.push(
{
Expand Down
11 changes: 11 additions & 0 deletions test/middleware/parameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,17 @@ describe('opencc', () => {
});
});

describe('brief', () => {
it(`brief`, async () => {
const response = await request.get('/test/brief?brief=100');
const parsed = await parser.parseString(response.text);
expect(parsed.items[0].title).toBe('小可愛');
expect(parsed.items[0].content).toBe(
'<p>宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵宇宙無敵…</p>'
);
});
});

describe('multi parameter', () => {
it(`filter before limit`, async () => {
const response = await request.get('/test/filter-limit?filterout_title=2&limit=2');
Expand Down