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, 'Security Ministry'); buildingId = found?.buildingId; }); test('view', async () => { if (buildingId === undefined) { console.warn('Skipping: no Security Ministry building on the fixture account'); return; } const { result } = await lacuna.security.view({ building_id: buildingId }); expect(result?.building).toBeDefined(); expect(result?.building.name).toBe('Security Ministry'); expectMatchesApiSchema('security', 'view', result); }); test('getStatsForLevel', async () => { if (buildingId === undefined) { console.warn('Skipping: no Security Ministry building on the fixture account'); return; } const { result } = await lacuna.security.getStatsForLevel({ building_id: buildingId, level: 1, }); expect(result?.building).toBeDefined(); expectMatchesApiSchema('security', 'get_stats_for_level', result); }); test('viewPrisoners', async () => { if (buildingId === undefined) { console.warn('Skipping: no Security Ministry building on the fixture account'); return; } const { result } = await lacuna.security.viewPrisoners({ building_id: buildingId }); expect(result?.prisoners).toBeDefined(); expectMatchesApiSchema('security', 'view_prisoners', result); }); test('viewForeignSpies', async () => { if (buildingId === undefined) { console.warn('Skipping: no Security Ministry building on the fixture account'); return; } const { result } = await lacuna.security.viewForeignSpies({ building_id: buildingId }); expect(result?.spies).toBeDefined(); expectMatchesApiSchema('security', 'view_foreign_spies', result); }); // executePrisoner / releasePrisoner both act on a specific prisoner (kill or // free them) - they're mutations, so they're intentionally not exercised here.