diff --git a/lib/routes-new/test/index.ts b/lib/routes-new/test/index.ts
new file mode 100644
index 000000000..fbf581b75
--- /dev/null
+++ b/lib/routes-new/test/index.ts
@@ -0,0 +1,410 @@
+import { config } from '@/config';
+import got from '@/utils/got';
+import wait from '@/utils/wait';
+import cache from '@/utils/cache';
+import { DataItem, Route } from '@/types';
+
+let cacheIndex = 0;
+
+export const route: Route = {
+ path: '/bangumi/media/:mediaid',
+ categories: ['new-media'],
+ example: '/bilibili/bangumi/media/9192',
+ parameters: {
+ mediaid: '番剧媒体 id, 番剧主页 URL 中获取',
+ },
+ features: {
+ requireConfig: false,
+ requirePuppeteer: false,
+ antiCrawler: false,
+ supportRadar: false,
+ supportBT: false,
+ supportPodcast: false,
+ supportScihub: false,
+ },
+ name: '番剧',
+ maintainers: ['DIYgod'],
+ radar: {
+ source: ['www.bilibili.com/bangumi/media/:bid'],
+ target: '/bangumi/media/:bid',
+ },
+ handler,
+};
+
+async function handler(ctx) {
+ if (ctx.req.param('id') === 'error') {
+ throw new Error('Error test');
+ }
+ if (ctx.req.param('id') === 'httperror') {
+ await got({
+ method: 'get',
+ url: 'https://httpbingo.org/status/404',
+ });
+ }
+ let item: DataItem[] = [];
+ switch (ctx.req.param('id')) {
+ case 'filter':
+ item = [
+ {
+ title: 'Filter Title1',
+ description: 'Description1',
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://github.com/DIYgod/RSSHub/issues/-1`,
+ author: `DIYgod0`,
+ category: ['Category0', 'Category1'],
+ },
+ {
+ title: 'Filter Title2',
+ description: 'Description2',
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://github.com/DIYgod/RSSHub/issues/0`,
+ author: `DIYgod0`,
+ category: ['Category0', 'Category1', 'Category2'],
+ },
+ {
+ title: 'Filter Title3',
+ description: 'Description3',
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://github.com/DIYgod/RSSHub/issues/1`,
+ author: `DIYgod0`,
+ category: 'Category3',
+ },
+ ];
+
+ break;
+
+ case 'filter-illegal-category':
+ item.push({
+ title: 'TitleIllegal',
+ description: 'DescriptionIllegal',
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://github.com/DIYgod/RSSHub/issues/1`,
+ author: `DIYgod0`,
+ category: [1, 'CategoryIllegal', true, null, undefined, { type: 'object' }],
+ });
+
+ break;
+
+ case 'long':
+ item.push({
+ title: `Long Title `.repeat(50),
+ description: `Long Description `.repeat(10),
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://github.com/DIYgod/RSSHub/issues/0`,
+ author: `DIYgod0`,
+ });
+
+ break;
+
+ case 'cache': {
+ const description = await cache.tryGet(
+ 'test',
+ () => ({
+ text: `Cache${++cacheIndex}`,
+ }),
+ config.cache.routeExpire * 2
+ );
+ item.push({
+ title: 'Cache Title',
+ description: description.text,
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://github.com/DIYgod/RSSHub/issues/0`,
+ author: `DIYgod0`,
+ });
+
+ break;
+ }
+ case 'refreshCache': {
+ let refresh = await cache.get('refreshCache');
+ let noRefresh = await cache.get('noRefreshCache', false);
+ if (!refresh) {
+ refresh = '0';
+ await cache.set('refreshCache', '1');
+ }
+ if (!noRefresh) {
+ noRefresh = '0';
+ await cache.set('noRefreshCache', '1', undefined);
+ }
+ item.push({
+ title: 'Cache Title',
+ description: refresh + ' ' + noRefresh,
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://github.com/DIYgod/RSSHub/issues/0`,
+ author: `DIYgod0`,
+ });
+
+ break;
+ }
+ case 'cacheUrlKey': {
+ const description = await cache.tryGet(
+ new URL('https://rsshub.app'),
+ () => ({
+ text: `Cache${++cacheIndex}`,
+ }),
+ config.cache.routeExpire * 2
+ );
+ item.push({
+ title: 'Cache Title',
+ description: description.text,
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://github.com/DIYgod/RSSHub/issues/0`,
+ author: `DIYgod0`,
+ });
+
+ break;
+ }
+ case 'complicated':
+ item.push(
+ {
+ title: `Complicated Title`,
+ description: `
+
+
+
+
+
+
+
+
+
+`,
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `//mock.com/DIYgod/RSSHub`,
+ author: `DIYgod`,
+ },
+ {
+ title: `Complicated Title`,
+ description: `
+
`,
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://mock.com/DIYgod/RSSHub`,
+ author: `DIYgod`,
+ }
+ );
+
+ break;
+
+ case 'multimedia':
+ item.push({
+ title: `Multimedia Title`,
+ description: `
+
+
+
+`,
+ pubDate: new Date(`2019-3-1`).toUTCString(),
+ link: `https://mock.com/DIYgod/RSSHub`,
+ author: `DIYgod`,
+ });
+
+ break;
+
+ case 'sort':
+ item.push(
+ {
+ title: `Sort Title 0`,
+ link: `https://github.com/DIYgod/RSSHub/issues/s1`,
+ author: `DIYgod0`,
+ },
+ {
+ title: `Sort Title 1`,
+ link: `https://github.com/DIYgod/RSSHub/issues/s1`,
+ author: `DIYgod0`,
+ },
+ {
+ title: `Sort Title 2`,
+ link: `https://github.com/DIYgod/RSSHub/issues/s2`,
+ pubDate: new Date(1_546_272_000_000 - 10 * 10 * 1000).toUTCString(),
+ author: `DIYgod0`,
+ },
+ {
+ title: `Sort Title 3`,
+ link: `https://github.com/DIYgod/RSSHub/issues/s3`,
+ pubDate: new Date(1_546_272_000_000).toUTCString(),
+ author: `DIYgod0`,
+ }
+ );
+
+ break;
+
+ case 'mess':
+ item.push({
+ title: `Mess Title`,
+ link: `/DIYgod/RSSHub/issues/0`,
+ pubDate: 1_546_272_000_000,
+ author: `DIYgod0`,
+ });
+
+ break;
+
+ case 'opencc':
+ item.push({
+ title: '小可愛',
+ description: '宇宙無敵',
+ link: `/DIYgod/RSSHub/issues/0`,
+ pubDate: new Date(1_546_272_000_000).toUTCString(),
+ author: `DIYgod0`,
+ });
+
+ break;
+
+ case 'brief':
+ item.push({
+ title: '小可愛',
+ description: '
宇宙無敵