blob: dd1e7937cd77cc83edfae2fe578deee097c48060 [file] [log] [blame]
223010143d966302025-06-07 22:54:40 +08001import { render, screen } from '@testing-library/react';
2import OtherCategory from '../../feature/categories/OtherCategory';
3import { Provider } from 'react-redux';
4import { store } from '../../store/store';
5import { MemoryRouter } from 'react-router';
6
7describe('OtherCategory Component', () => {
8 it('renders other resources category page with search and resource cards', () => {
9 render(
10 <MemoryRouter>
11 <Provider store={store}>
12 <OtherCategory />
13 </Provider>
14 </MemoryRouter>
15 );
16
17 // 验证标题和描述
18 expect(screen.getByText('其他资源分区')).toBeInTheDocument();
19 expect(screen.getByText('软件、电子书等其他类型资源')).toBeInTheDocument();
20
21 // 验证搜索框
22 const searchInput = screen.getByPlaceholderText('搜索资源名称或描述');
23 expect(searchInput).toBeInTheDocument();
24
25 // 验证资源卡片
26 expect(screen.getByText('盗梦空间')).toBeInTheDocument();
27 expect(screen.getByText('肖申克的救赎')).toBeInTheDocument();
28
29 // 验证类型信息
30 expect(screen.getByText('类型: 未知类型')).toBeInTheDocument();
31 });
32});