my-kaiqiuwang/__test__/kaiqiu.test.ts
kyuuseiryuu 4453dd6430 refactor(service, routes, types): extract match summary and link to club
- Extract club information (clubId, clubName) from event page in `getEventInfo`.
- Update `getMatchDetail` to return both `detail` and `summary`.
- Introduce `MatchSummary` interface in `src/types/index.ts`.
- Update `EventPage` to display the club name and link to the club page.
- Adjust `EventSubscribeService` and loaders to handle the new return structure.
- Clean up test files and mock data loading logic.
2026-03-25 23:20:33 +09:00

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]?.id ?? '';
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);
});