import Lacuna from '../lacuna'; import _ from 'lodash'; import { getLacuna } from '../__utils__/get-lacuna'; import { expectMatchesApiSchema } from '../__utils__/validate-schema'; let lacuna: Lacuna; let pccId: number; beforeAll(async () => { lacuna = await getLacuna(); const { result } = await lacuna.empire.getStatus(); const { empire } = result!; const { result: buildingsResult } = await lacuna.body.getBuildings({ body_id: empire.home_planet_id, }); const { buildings } = buildingsResult!; pccId = _.chain(buildings) .keys() .filter((key) => buildings[key].name === 'Planetary Command Center') .first() .toInteger() .value(); }); test('view', async () => { const { result } = await lacuna.planetaryCommand.view({ building_id: pccId }); expect(result?.building).toBeDefined(); expect(result?.building.name).toBe('Planetary Command Center'); expectMatchesApiSchema('planetarycommand', 'view', result); });