Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
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
92 changes: 92 additions & 0 deletions lib/routes/shui5cn/all-routes.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { describe, expect, it } from 'vitest';

import { route as bulletinRoute } from './bulletin';
import { route as difangCaishuiFaguiRoute } from './difang-caishui-fagui';
import { route as faguiJieduRoute } from './fagui-jiedu';
import { route as nashuiPingguRoute } from './nashui-pinggu';
import { route as nashuiTiaozhenRoute } from './nashui-tiaozhen';
import { route as nianduCaishuiFaguiRoute } from './niandu-caishui-fagui';
import { route as shuishouYouhuiRoute } from './shuishou-youhui';
import { route as shuiwuChouhuaRoute } from './shuiwu-chouhua';
import { route as shuiwuJichaAnliRoute } from './shuiwu-jicha-anli';
import { route as shuiwuWendaRoute } from './shuiwu-wenda';

describe('shui5cn routes', () => {
const testRoute = async (route: any, routeName: string, expectedTitle: string) => {

Check warning

Code scanning / ESLint

Move function definitions to the highest possible scope. Warning

Move async arrow function 'testRoute' to the outer scope.
const data = (await route.handler({} as any)) as any;

// 验证基本结构
expect(data).toBeTruthy();
expect(data.title).toEqual(expectedTitle);
expect(data.link).toMatch(/^https:\/\/www\.shui5\.cn\/article\//);
expect(data.description).toContain('税屋网');
expect(data.language).toEqual('zh-CN');

// 验证文章列表
expect(data.item).toEqual(expect.any(Array));
expect(data.item.length).toBeGreaterThan(0);
expect(data.item.length).toBeLessThanOrEqual(30);

// 验证第一篇文章的结构
const firstItem = data.item[0];
expect(firstItem).toHaveProperty('title');
expect(firstItem).toHaveProperty('link');
expect(firstItem).toHaveProperty('description');
expect(firstItem).toHaveProperty('pubDate');
expect(firstItem).toHaveProperty('author');
expect(firstItem).toHaveProperty('category');

// 验证字段类型
expect(firstItem.title).toEqual(expect.any(String));
expect(firstItem.link).toMatch(/^https?:\/\//);
expect(firstItem.description).toEqual(expect.any(String));
expect(firstItem.author).toEqual(expect.any(String));
expect(firstItem.category).toEqual(expect.any(Array));
expect(firstItem.category[0]).toEqual('财税');

// 验证 description 不为空(除非是错误情况)
if (!firstItem.description.includes('获取文章内容失败')) {
expect(firstItem.description.length).toBeGreaterThan(0);
}
};

it('shuishou-youhui (税收优惠)', async () => {
await testRoute(shuishouYouhuiRoute, 'shuishou-youhui', '税屋网 - 税收优惠');
}, 120000);

it('shuiwu-chouhua (税务筹划)', async () => {
await testRoute(shuiwuChouhuaRoute, 'shuiwu-chouhua', '税屋网 - 税务筹划');
}, 120000);

it('shuiwu-jicha-anli (税务稽查案例)', async () => {
await testRoute(shuiwuJichaAnliRoute, 'shuiwu-jicha-anli', '税屋网 - 税务稽查案例');
}, 120000);

it('nashui-pinggu (纳税评估)', async () => {
await testRoute(nashuiPingguRoute, 'nashui-pinggu', '税屋网 - 纳税评估');
}, 120000);

it('nashui-tiaozhen (纳税调整)', async () => {
await testRoute(nashuiTiaozhenRoute, 'nashui-tiaozhen', '税屋网 - 纳税调整');
}, 120000);

it('shuiwu-wenda (税务问答)', async () => {
await testRoute(shuiwuWendaRoute, 'shuiwu-wenda', '税屋网 - 税务问答');
}, 120000);

it('bulletin (公告)', async () => {
await testRoute(bulletinRoute, 'bulletin', '税屋网 - 公告');
}, 120000);

it('difang-caishui-fagui (地方财税法规)', async () => {
await testRoute(difangCaishuiFaguiRoute, 'difang-caishui-fagui', '税屋网 - 地方财税法规');
}, 120000);

it('niandu-caishui-fagui (年度财税法规)', async () => {
await testRoute(nianduCaishuiFaguiRoute, 'niandu-caishui-fagui', '税屋网 - 年度财税法规');
}, 120000);

it('fagui-jiedu (法规解读)', async () => {
await testRoute(faguiJieduRoute, 'fagui-jiedu', '税屋网 - 法规解读');
}, 120000);
});
36 changes: 36 additions & 0 deletions lib/routes/shui5cn/bulletin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Route } from '@/types';

import { fetchShui5cnCategory } from './utils';

export const route: Route = {
path: '/bulletin',
categories: ['finance'],
example: '/shui5cn/bulletin',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['shui5.cn/article/Bulletin/'],
target: '/bulletin',
},
],
name: '公告',
maintainers: ['anuxs'],
handler,
url: 'shui5.cn/article/Bulletin/',
};

async function handler() {
return await fetchShui5cnCategory({
categoryPath: 'Bulletin',
categoryName: '公告',
categoryLabel: '公告',
});
}
36 changes: 36 additions & 0 deletions lib/routes/shui5cn/difang-caishui-fagui.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Route } from '@/types';

import { fetchShui5cnCategory } from './utils';

export const route: Route = {
path: '/difang-caishui-fagui',
categories: ['finance'],
example: '/shui5cn/difang-caishui-fagui',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['shui5.cn/article/DiFangCaiShuiFaGui/'],
target: '/difang-caishui-fagui',
},
],
name: '地方财税法规',
maintainers: ['anuxs'],
handler,
url: 'shui5.cn/article/DiFangCaiShuiFaGui/',
};

async function handler() {
return await fetchShui5cnCategory({
categoryPath: 'DiFangCaiShuiFaGui',
categoryName: '地方财税法规',
categoryLabel: '地方财税法规',
});
}
36 changes: 36 additions & 0 deletions lib/routes/shui5cn/fagui-jiedu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Route } from "@/types";

import { fetchShui5cnCategory } from "./utils";

export const route: Route = {
path: "/fagui-jiedu",
categories: ["finance"],
example: "/shui5cn/fagui-jiedu",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ["shui5.cn/article/FaGuiJieDu/"],
target: "/fagui-jiedu",
},
],
name: "法规解读",
maintainers: ["anuxs"],
handler,
url: "shui5.cn/article/FaGuiJieDu/",
};

async function handler() {
return await fetchShui5cnCategory({
categoryPath: "FaGuiJieDu",
categoryName: "法规解读",
categoryLabel: "法规解读",
});
}
7 changes: 7 additions & 0 deletions lib/routes/shui5cn/namespace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { Namespace } from '@/types';

export const namespace: Namespace = {
name: '税屋网',
url: 'shui5.cn',
lang: 'zh-CN',
};
36 changes: 36 additions & 0 deletions lib/routes/shui5cn/nashui-pinggu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Route } from '@/types';

import { fetchShui5cnCategory } from './utils';

export const route: Route = {
path: '/nashui-pinggu',
categories: ['finance'],
example: '/shui5cn/nashui-pinggu',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['shui5.cn/article/NaShuiPingGu/'],
target: '/nashui-pinggu',
},
],
name: '纳税评估',
maintainers: ['anuxs'],
handler,
url: 'shui5.cn/article/NaShuiPingGu/',
};

async function handler() {
return await fetchShui5cnCategory({
categoryPath: 'NaShuiPingGu',
categoryName: '纳税评估',
categoryLabel: '纳税评估',
});
}
36 changes: 36 additions & 0 deletions lib/routes/shui5cn/nashui-tiaozhen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Route } from '@/types';

import { fetchShui5cnCategory } from './utils';

export const route: Route = {
path: '/nashui-tiaozhen',
categories: ['finance'],
example: '/shui5cn/nashui-tiaozhen',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['shui5.cn/article/NaShuiTiaoZhen/'],
target: '/nashui-tiaozhen',
},
],
name: '纳税调整',
maintainers: ['anuxs'],
handler,
url: 'shui5.cn/article/NaShuiTiaoZhen/',
};

async function handler() {
return await fetchShui5cnCategory({
categoryPath: 'NaShuiTiaoZhen',
categoryName: '纳税调整',
categoryLabel: '纳税调整',
});
}
36 changes: 36 additions & 0 deletions lib/routes/shui5cn/niandu-caishui-fagui.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Route } from '@/types';

import { fetchShui5cnCategory } from './utils';

export const route: Route = {
path: '/niandu-caishui-fagui',
categories: ['finance'],
example: '/shui5cn/niandu-caishui-fagui',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['shui5.cn/article/NianDuCaiShuiFaGui/'],
target: '/niandu-caishui-fagui',
},
],
name: '年度财税法规',
maintainers: ['anuxs'],
handler,
url: 'shui5.cn/article/NianDuCaiShuiFaGui/',
};

async function handler() {
return await fetchShui5cnCategory({
categoryPath: 'NianDuCaiShuiFaGui',
categoryName: '年度财税法规',
categoryLabel: '年度财税法规',
});
}
36 changes: 36 additions & 0 deletions lib/routes/shui5cn/shuishou-youhui.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Route } from '@/types';

import { fetchShui5cnCategory } from './utils';

export const route: Route = {
path: '/shuishou-youhui',
categories: ['finance'],
example: '/shui5cn/shuishou-youhui',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['shui5.cn/article/ShuiShouYouHui/'],
target: '/shuishou-youhui',
},
],
name: '税收优惠',
maintainers: ['anuxs'],
handler,
url: 'shui5.cn/article/ShuiShouYouHui/',
};

async function handler() {
return await fetchShui5cnCategory({
categoryPath: 'ShuiShouYouHui',
categoryName: '税收优惠',
categoryLabel: '税收优惠',
});
}
36 changes: 36 additions & 0 deletions lib/routes/shui5cn/shuiwu-chouhua.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Route } from '@/types';

import { fetchShui5cnCategory } from './utils';

export const route: Route = {
path: '/shuiwu-chouhua',
categories: ['finance'],
example: '/shui5cn/shuiwu-chouhua',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['shui5.cn/article/ShuiWuChouHua/'],
target: '/shuiwu-chouhua',
},
],
name: '税务筹划',
maintainers: ['anuxs'],
handler,
url: 'shui5.cn/article/ShuiWuChouHua/',
};

async function handler() {
return await fetchShui5cnCategory({
categoryPath: 'ShuiWuChouHua',
categoryName: '税务筹划',
categoryLabel: '税务筹划',
});
}
Loading
Loading