mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(place-names): a load starts with no failures, so packs that failed earlier do not mark a retry that lands as failed
This commit is contained in:
1 parent
c5e1951f51
commit
2f31828d28
2 files changed
+49
-8
No files matched your search
@@ -55,3 +55,37 @@ test('one lookup that loads several packs reads as one load', async () => {
|
||||
assert.deepEqual(heard, [true, false], 'no gap between the packs');
|
||||
stop();
|
||||
});
|
||||
|
||||
test('a load is not blamed for packs that failed in an earlier one', async () => {
|
||||
const place = await import('./placeBelow.js?two-failed');
|
||||
let fail = true;
|
||||
const pack = (name) =>
|
||||
place.reportedPlacePackLoad(name, async () => {
|
||||
if (fail) throw new Error('offline');
|
||||
return name;
|
||||
});
|
||||
const divisions = pack('divisions');
|
||||
const places = pack('places');
|
||||
await assert.rejects(divisions());
|
||||
await assert.rejects(places());
|
||||
assert.equal(place.placePacksStatus().failed, true);
|
||||
fail = false;
|
||||
// One lookup retries both, one after the other.
|
||||
const lookup = place.placeBelow(48.86, 2.35, {
|
||||
detail: {
|
||||
division: async () => divisions(),
|
||||
near: async () => places(),
|
||||
},
|
||||
});
|
||||
const statuses = [];
|
||||
const stop = place.onPlacePacksLoadingChange(() =>
|
||||
statuses.push(place.placePacksStatus()),
|
||||
);
|
||||
await lookup;
|
||||
stop();
|
||||
assert.ok(statuses.length > 0);
|
||||
assert.ok(
|
||||
statuses.every((status) => status.failed === false),
|
||||
'the earlier failures do not colour this load',
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user