Something went wrong. Try again.
TypeScript client for accessing TLE Community.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869import { 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.