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, 'Intelligence Ministry'); buildingId = found?.buildingId; }); test('view', async () => { if (buildingId === undefined) { console.warn('Skipping: no Intelligence Ministry building on the fixture account'); return; } const { result } = await lacuna.intelligence.view({ building_id: buildingId }); expect(result?.building).toBeDefined(); expect(result?.building.name).toBe('Intelligence Ministry'); expectMatchesApiSchema('intelligence', 'view', result); }); test('getStatsForLevel', async () => { if (buildingId === undefined) { console.warn('Skipping: no Intelligence Ministry building on the fixture account'); return; } const { result } = await lacuna.intelligence.getStatsForLevel({ building_id: buildingId, level: 1, }); expect(result?.building).toBeDefined(); expectMatchesApiSchema('intelligence', 'get_stats_for_level', result); }); test('viewSpies', async () => { if (buildingId === undefined) { console.warn('Skipping: no Intelligence Ministry building on the fixture account'); return; } const { result } = await lacuna.intelligence.viewSpies({ building_id: buildingId }); expect(result?.spies).toBeDefined(); expect(result?.spy_count).toBeDefined(); expectMatchesApiSchema('intelligence', 'view_spies', result); }); test('viewAllSpies', async () => { if (buildingId === undefined) { console.warn('Skipping: no Intelligence Ministry building on the fixture account'); return; } const { result } = await lacuna.intelligence.viewAllSpies({ building_id: buildingId }); expect(result?.spies).toBeDefined(); expect(result?.spy_count).toBeDefined(); expectMatchesApiSchema('intelligence', 'view_all_spies', result); });