保存本地对routes.ts的修改
Change-Id: I4f4dbd8069893d7363e251130791dc0594be44e1
diff --git a/src/test/category/GameCategory.test.tsx b/src/test/category/GameCategory.test.tsx
new file mode 100644
index 0000000..ad42353
--- /dev/null
+++ b/src/test/category/GameCategory.test.tsx
@@ -0,0 +1,33 @@
+import { render, screen } from '@testing-library/react';
+import GameCategory from '../../feature/categories/GameCategory';
+import { Provider } from 'react-redux';
+import { store } from '../../store/store';
+import { MemoryRouter } from 'react-router';
+
+describe('GameCategory Component', () => {
+ it('renders game category page with search and game cards', () => {
+ render(
+ <MemoryRouter>
+ <Provider store={store}>
+ <GameCategory />
+ </Provider>
+ </MemoryRouter>
+ );
+
+ // 验证标题和描述
+ expect(screen.getByText('游戏资源分区')).toBeInTheDocument();
+ expect(screen.getByText('PC、主机游戏资源分享')).toBeInTheDocument();
+
+ // 验证搜索框
+ const searchInput = screen.getByPlaceholderText('搜索游戏名称或开发商');
+ expect(searchInput).toBeInTheDocument();
+
+ // 验证游戏卡片
+ expect(screen.getByText('赛博朋克2077')).toBeInTheDocument();
+ expect(screen.getByText('艾尔登法环')).toBeInTheDocument();
+
+ // 验证开发商信息
+ expect(screen.getByText('开发商: CD Projekt Red')).toBeInTheDocument();
+ expect(screen.getByText('开发商: FromSoftware')).toBeInTheDocument();
+ });
+});
\ No newline at end of file
diff --git a/src/test/category/MovieCategory.test.tsx b/src/test/category/MovieCategory.test.tsx
new file mode 100644
index 0000000..be1ed01
--- /dev/null
+++ b/src/test/category/MovieCategory.test.tsx
@@ -0,0 +1,33 @@
+import { render, screen } from '@testing-library/react';
+import MovieCategory from '../../feature/categories/MovieCategory';
+import { Provider } from 'react-redux';
+import { store } from '../../store/store';
+import { MemoryRouter } from 'react-router';
+
+describe('MovieCategory Component', () => {
+ it('renders movie category page with search and movie cards', () => {
+ render(
+ <MemoryRouter>
+ <Provider store={store}>
+ <MovieCategory />
+ </Provider>
+ </MemoryRouter>
+ );
+
+ // 验证标题和描述
+ expect(screen.getByText('影视资源分区')).toBeInTheDocument();
+ expect(screen.getByText('高清电影、电视剧、纪录片资源分享')).toBeInTheDocument();
+
+ // 验证搜索框
+ const searchInput = screen.getByPlaceholderText('搜索电影或导演');
+ expect(searchInput).toBeInTheDocument();
+
+ // 验证电影卡片
+ expect(screen.getByText('盗梦空间')).toBeInTheDocument();
+ expect(screen.getByText('肖申克的救赎')).toBeInTheDocument();
+
+ // 验证导演信息
+ expect(screen.getByText('导演: 克里斯托弗·诺兰')).toBeInTheDocument();
+ expect(screen.getByText('导演: 弗兰克·德拉邦特')).toBeInTheDocument();
+ });
+});
\ No newline at end of file
diff --git a/src/test/category/MusicCategory.test.tsx b/src/test/category/MusicCategory.test.tsx
new file mode 100644
index 0000000..4de1bdf
--- /dev/null
+++ b/src/test/category/MusicCategory.test.tsx
@@ -0,0 +1,38 @@
+import { render, screen } from '@testing-library/react';
+import MusicCategory from '../../feature/categories/MusicCategory';
+import { Provider } from 'react-redux';
+import { store } from '../../store/store';
+import { MemoryRouter } from 'react-router';
+
+describe('MusicCategory Component', () => {
+ it('renders music category page with search, filters and music cards', () => {
+ render(
+ <MemoryRouter>
+ <Provider store={store}>
+ <MusicCategory />
+ </Provider>
+ </MemoryRouter>
+ );
+
+ // 验证标题和描述
+ expect(screen.getByText('音乐资源分区')).toBeInTheDocument();
+ expect(screen.getByText('高质量音乐资源共享,保持分享率,共建良好PT环境')).toBeInTheDocument();
+
+ // 验证搜索框
+ const searchInput = screen.getByPlaceholderText('搜索音乐名称或艺术家');
+ expect(searchInput).toBeInTheDocument();
+
+ // 验证音质筛选
+ expect(screen.getByText('音质筛选:')).toBeInTheDocument();
+ expect(screen.getByText('全部')).toBeInTheDocument();
+ expect(screen.getByText('FLAC')).toBeInTheDocument();
+
+ // 验证分类标签
+ expect(screen.getByText('欧美流行 (15)')).toBeInTheDocument();
+ expect(screen.getByText('华语流行 (23)')).toBeInTheDocument();
+
+ // 验证音乐卡片
+ expect(screen.getByText('Blinding Lights')).toBeInTheDocument();
+ expect(screen.getByText('Bohemian Rhapsody')).toBeInTheDocument();
+ });
+});
\ No newline at end of file
diff --git a/src/test/category/OtherCategory.test.tsx b/src/test/category/OtherCategory.test.tsx
new file mode 100644
index 0000000..dd1e793
--- /dev/null
+++ b/src/test/category/OtherCategory.test.tsx
@@ -0,0 +1,32 @@
+import { render, screen } from '@testing-library/react';
+import OtherCategory from '../../feature/categories/OtherCategory';
+import { Provider } from 'react-redux';
+import { store } from '../../store/store';
+import { MemoryRouter } from 'react-router';
+
+describe('OtherCategory Component', () => {
+ it('renders other resources category page with search and resource cards', () => {
+ render(
+ <MemoryRouter>
+ <Provider store={store}>
+ <OtherCategory />
+ </Provider>
+ </MemoryRouter>
+ );
+
+ // 验证标题和描述
+ expect(screen.getByText('其他资源分区')).toBeInTheDocument();
+ expect(screen.getByText('软件、电子书等其他类型资源')).toBeInTheDocument();
+
+ // 验证搜索框
+ const searchInput = screen.getByPlaceholderText('搜索资源名称或描述');
+ expect(searchInput).toBeInTheDocument();
+
+ // 验证资源卡片
+ expect(screen.getByText('盗梦空间')).toBeInTheDocument();
+ expect(screen.getByText('肖申克的救赎')).toBeInTheDocument();
+
+ // 验证类型信息
+ expect(screen.getByText('类型: 未知类型')).toBeInTheDocument();
+ });
+});
\ No newline at end of file