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);
});