my-kaiqiuwang/__test__/xcxapi.test.ts
2026-01-29 22:00:49 +09:00

21 lines
731 B
TypeScript

import { test, expect } from 'bun:test';
import fs from 'fs';
import path from 'path';
import { XCXAPI } from '../src/services/xcxApi';
const xcxApi = new XCXAPI(process.env.KAIQIUCC_TOKEN ?? '');
test('Test profile', async () => {
const uid = '73276';
const profile = await xcxApi.getAdvProfile(uid);
expect(profile).not.toBe(null)
fs.writeFileSync(path.resolve(__dirname, 'data', 'profile.json'), JSON.stringify(profile, null, 2));
});
test('Test game list', async () => {
const uid = '73276';
const list = await xcxApi.getGameList(uid);
expect(list).not.toBe(null)
expect(list?.length).toBeGreaterThan(0)
fs.writeFileSync(path.resolve(__dirname, 'data', 'gamelist.json'), JSON.stringify(list, null, 2));
});