import test from 'node:test'; import assert from 'node:assert/strict'; import * as geo from '../../geo/index.js'; import { createControls } from './controls.js'; test('focus frames a selected installation through the globe engine camera', () => { const record = { id: 'osm:node:12', latitude: 70, longitude: 179.8 }; let flight = null; const state = { engine: { camera: { flyToSphere: (sphere, options) => { flight = { sphere, options }; }, }, }, recordById: new Map([[record.id, record]]), }; const controls = createControls({ state, services: {}, parts: { selection: { selectRecord: (id) => id === record.id }, model: { installationSurfaceHeightM: () => 126 }, }, source: {}, }).methods; assert.equal(controls.focusById(record.id), true); assert.deepEqual( flight.sphere.center, geo.cartesian3.fromDegrees(179.8, 70, 126), ); assert.equal(flight.sphere.radius, 18000); assert.deepEqual(flight.options, { duration: 1.4 }); });