import { getLacuna } from '../../__utils__/get-lacuna'; import { expectMatchesApiSchema } from '../../__utils__/validate-schema'; import { findBuilding } from '../../__utils__/find-building'; import Lacuna from '../../lacuna'; let lacuna: Lacuna; let buildingId: number | undefined; beforeAll(async () => { lacuna = await getLacuna(); const found = await findBuilding(lacuna, 'Mission Command'); buildingId = found?.buildingId; }); test('view', async () => { if (buildingId === undefined) { console.warn('Skipping: no Mission Command building on the fixture account'); return; } const { result } = await lacuna.missionCommand.view({ building_id: buildingId }); expect(result?.building).toBeDefined(); expect(result?.building.name).toBe('Mission Command'); expectMatchesApiSchema('missioncommand', 'view', result); }); test('getStatsForLevel', async () => { if (buildingId === undefined) { console.warn('Skipping: no Mission Command building on the fixture account'); return; } const { result } = await lacuna.missionCommand.getStatsForLevel({ building_id: buildingId, level: 1, }); expect(result?.building).toBeDefined(); expectMatchesApiSchema('missioncommand', 'get_stats_for_level', result); }); test('getMissions', async () => { if (buildingId === undefined) { console.warn('Skipping: no Mission Command building on the fixture account'); return; } const { result } = await lacuna.missionCommand.getMissions({ building_id: buildingId }); if (!result) { console.warn( 'Skipping: servers without missions configured will not be able to respond to this request' ); return; } expect(result?.missions).toBeDefined(); expectMatchesApiSchema('missioncommand', 'get_missions', result); });