Something went wrong. Try again.
TypeScript client for accessing TLE Community.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758import 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);});