import Lacuna from '../../lacuna'; import _ from 'lodash'; import { getLacuna } from '../../__utils__/get-lacuna'; import { int } from '../../core/util'; import { expectMatchesApiSchema } from '../../__utils__/validate-schema'; import { findBuilding } from '../../__utils__/find-building'; let lacuna: Lacuna; let buildingId: number; beforeAll(async () => { lacuna = await getLacuna(); const found = await findBuilding(lacuna, 'Shipyard'); buildingId = found?.buildingId; }); test('view', async () => { if (buildingId === undefined) { console.warn('Skipping: no Shipyard building on the fixture account'); return; } const { result } = await lacuna.shipyard.view({ building_id: int(buildingId) }); expect(result?.building).toBeDefined(); expect(result?.building.name).toBe('Shipyard'); expectMatchesApiSchema('shipyard', 'view', result); }); test('viewBuildQueue', async () => { if (buildingId === undefined) { console.warn('Skipping: no Shipyard building on the fixture account'); return; } const { result } = await lacuna.shipyard.viewBuildQueue({ building_id: int(buildingId) }); expect(result?.cost_to_subsidize).toBeDefined(); expect(result?.ships_building).toBeDefined(); expect(result?.number_of_ships_building).toBeDefined(); expectMatchesApiSchema('shipyard', 'view_build_queue', result); }); test('getBuildable', async () => { if (buildingId === undefined) { console.warn('Skipping: no Shipyard building on the fixture account'); return; } const { result } = await lacuna.shipyard.getBuildable({ building_id: int(buildingId) }); expect(result?.buildable).toBeDefined(); expect(result?.build_queue_max).toBeDefined(); expect(result?.build_queue_used).toBeDefined(); expect(result?.docks_available).toBeDefined(); expectMatchesApiSchema('shipyard', 'get_buildable', result); });