- **Frontend Refactoring**: Extracted EventCard logic and finished game filtering from GameSelector into a new ClubEventsList component. Removed direct routing logic (handleGameClick, navigate) from App.tsx in favor of router loaders. - **New Feature - Club Detail Page**: Implemented /club/:id route with ClubEventsPage. Added server-side loader to fetch club info and events in parallel via new API endpoints (/api/club/find, /api/club/:id). Created KaiqiuService for direct data fetching. - **API & Types**: Extended IEventInfo with isFinished flag; updated server-side parsing in utils/server.ts. Added ClubInfo type definition. Migrated club search and filtering logic to the server side. - **Dependencies**: Updated antd from 6.2.1 to 6.3.2.
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { test, expect } from 'bun:test';
|
|
import { KaiqiuService } from '../src/services/KaiqiuService';
|
|
|
|
test("Test find 东华 club", async () => {
|
|
const result = await KaiqiuService.findClub('东华', 1);
|
|
console.debug(result);
|
|
expect(result.clubs.length).toBeGreaterThan(0);
|
|
expect(result.total).toBeGreaterThan(result.clubs.length - 1);
|
|
const clubId = result.clubs[0]?.clubId ?? '';
|
|
const club = await KaiqiuService.getClubInfo(clubId);
|
|
console.debug(club);
|
|
expect(club).toBeDefined();
|
|
expect(club?.name).toInclude('东华');
|
|
expect(club?.img).toBeDefined();
|
|
});
|
|
test("Test find 飞酷 club", async () => {
|
|
const result = await KaiqiuService.findClub('飞酷', 1);
|
|
console.debug(result);
|
|
expect(result.clubs.length).toBeGreaterThan(0);
|
|
expect(result.total).toBeGreaterThan(result.clubs.length - 1);
|
|
});
|
|
|
|
test("Test find normal club", async () => {
|
|
const result = await KaiqiuService.findClub('政和', 1, true);
|
|
console.debug(result);
|
|
expect(result.clubs.length).toBeGreaterThan(0);
|
|
expect(result.total).toBeGreaterThan(result.clubs.length - 1);
|
|
}); |