fix(cockpit): a place pack that will not load ends the loading batch failed; flags keep their neighbours out from under the border and out of a scaled flag's edge; a new ride asks again for a sheet that failed

This commit is contained in:
Sameh Khamis committed 2026-11-08 19:45:01 -08:00
1 parent 5a6cf22be1
commit e954734379
16 files changed
+198 -55

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
// src/ui/placePacksLoading.test.mjs — the loading status names the place
// packs while they load, and a failed pack ends the batch as failed.
import test from 'node:test';
import assert from 'node:assert/strict';
import {
aggregateLayerLoading,
createLoadingFeedbackState,
reduceLoadingFeedback,
} from '../loadingFeedback.js';
import { withPlacePacks } from './placePacksLoading.js';
const SATELLITES = Object.freeze({
id: 'satellites',
name: 'Satellites',
enabled: true,
stats: { count: 9000, lastUpdate: 1 },
});
function batch(states) {
let state = createLoadingFeedbackState();
let now = 0;
for (const status of states) {
now += 1000;
state = reduceLoadingFeedback(
state,
aggregateLayerLoading(withPlacePacks([SATELLITES], status)),
now,
);
}
return state;
}
test('nothing extra while the packs are idle', () => {
const layers = [SATELLITES];
assert.equal(
withPlacePacks(layers, { loading: false, failed: false }),
layers,
);
});
test('the packs are named while they load', () => {
const summary = aggregateLayerLoading(
withPlacePacks([SATELLITES], { loading: true, failed: false }),
);
assert.deepEqual(summary.activeIds, ['place-names']);
assert.equal(summary.active[0].label, 'Place names');
});
test('a load that lands ends complete; one that fails ends failed', () => {
const loading = { loading: true, failed: false };
assert.equal(
batch([loading, { loading: false, failed: false }]).terminal,
'complete',
);
assert.equal(
batch([loading, { loading: false, failed: true }]).terminal,
'error',
);
});