mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 07:42:23 +00:00
fix(satellites): class choices survive a reload and travel in share links
Only catalog and the tracked satellite were saved for the layer, so a class
chip lasted until the next reload and no share link carried it. The choice
is now the satellites option `classes`: one letter per class shown
(`sitpd` by default, `0` for none), with Starlink left to `catalog`, and
the layer takes the letters back through setParams. A partial request
(`{debris: false}`) hides only what it names.
This commit is contained in:
1 parent
8ae56587c3
commit
c84cfcadeb
9 files changed
+148
-12
No files matched your search
@@ -970,6 +970,41 @@ test('a direct Context selection promotes its owned tracker layer before persist
|
||||
coordinator.destroy();
|
||||
});
|
||||
|
||||
test('a satellite class choice is saved, shared and restored', async () => {
|
||||
const storage = memoryStorage();
|
||||
const manager = productionManager();
|
||||
const coordinator = new LayerStateCoordinator(manager, shareSink(), {
|
||||
storage,
|
||||
});
|
||||
await coordinator.start();
|
||||
await manager.setEnabled('satellites', true, { origin: 'user' });
|
||||
assert.equal(
|
||||
coordinator.getDurableState().options.satellites.classes,
|
||||
'sitpd',
|
||||
'every class but Starlink by default',
|
||||
);
|
||||
manager.setLayerParams(
|
||||
'satellites',
|
||||
{ classes: { debris: false } },
|
||||
{ origin: 'user' },
|
||||
);
|
||||
const durable = coordinator.getDurableState();
|
||||
assert.equal(durable.options.satellites.classes, 'sitp');
|
||||
assert.equal(
|
||||
new URLSearchParams(encode(durable)).get('lo')?.includes('s.k.sitp'),
|
||||
true,
|
||||
);
|
||||
coordinator.destroy();
|
||||
|
||||
// A reload hands the layer its letters back (the layer decodes them:
|
||||
// src/data/satelliteClass.test.mjs).
|
||||
const reloaded = productionManager();
|
||||
const next = new LayerStateCoordinator(reloaded, shareSink(), { storage });
|
||||
await next.start();
|
||||
assert.equal(reloaded.getLayerParams('satellites')?.classes, 'sitp');
|
||||
next.destroy();
|
||||
});
|
||||
|
||||
test('explicit Flight to Satellite replacement keeps the new Satellite ID durable', async () => {
|
||||
const manager = productionManager();
|
||||
const coordinator = new LayerStateCoordinator(manager, shareSink(), {
|
||||
|
||||
Reference in new issue
Block a user