21 lines
731 B
TypeScript
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));
|
|
}); |