Frame a view that only follows an aircraft where the aircraft is

Asked for an aircraft's cockpit view, assistants passed only the follow,
which failed for want of an area or camera, so every such request took
a second call. show_in_gods_eye_view now looks the aircraft up and frames
the view on it, and says so when the aircraft is not reported.
This commit is contained in:
Sameh Khamis committed 2026-10-02 18:29:42 -07:00
1 parent ae00f009e6
commit b69d34bad2
2 files changed
+70 -9

No files matched your search

+33
View File
@@ -75,3 +75,36 @@ test('show_in_gods_eye_view names the panel and shows a view another answer retu
(error) => error.code === 'invalid_arguments',
);
});
test('a view that only follows an aircraft is framed where the aircraft is', async () => {
const { resolveViewArguments } = await import('./queries/share.js');
const tools = {
has: (name) => name === 'find_aircraft',
call: async (name, args) => ({
data: {
rows:
args.icao24 === 'ae1234'
? [{ id: 'ae1234', lat: 32.7, lon: -117.2 }]
: [],
},
}),
};
const { view, label } = await resolveViewArguments(
{ follow: { kind: 'military_aircraft', id: 'ae1234', cockpit: true } },
{ services: {}, tools },
);
assert.deepEqual(
[view.camera.lat, view.camera.lon, view.follow.cockpit],
[32.7, -117.2, true],
);
assert.equal(label, 'military aircraft ae1234');
await assert.rejects(
resolveViewArguments(
{ follow: { kind: 'aircraft', id: 'abc999' } },
{ services: {}, tools },
),
(error) =>
error.code === 'invalid_arguments' &&
/not reported now/.test(error.message),
);
});