mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-14 07:12:21 +00:00
fix(cockpit): a provider member that throws when read (a getter) leaves that provider out with one warning and keeps the rest; a worded member that starts throwing keeps its last good words; a candidate, frame or HUD view whose getter throws reads as null, so the view ends or keeps its last HUD
This commit is contained in:
1 parent
22f43aab01
commit
fbc1a9a0ec
6 files changed
+264
-92
No files matched your search
@@ -604,6 +604,16 @@ test('the view ends when the frame stops coming, and gives the subject back', as
|
||||
for (const ending of [
|
||||
null,
|
||||
{ latitude: LAT, longitude: LON, id: 'other', eye: { upM: 2 } },
|
||||
// A frame whose getter throws runs provider code: as a malformed frame.
|
||||
Object.defineProperty(
|
||||
{ id: 'a1', longitude: LON, eye: { upM: 2 } },
|
||||
'latitude',
|
||||
{
|
||||
get() {
|
||||
throw new Error('latitude unavailable');
|
||||
},
|
||||
},
|
||||
),
|
||||
]) {
|
||||
const ride = subjectProvider();
|
||||
const { cockpit } = fixture(t, { providers: [ride] });
|
||||
@@ -937,6 +947,17 @@ test('a read that throws ends the view once; a hud that throws keeps the last',
|
||||
await settle();
|
||||
assert.equal(cockpit.active, true);
|
||||
assert.equal($('#cockpit-callsign').textContent, HUD.title, 'last view kept');
|
||||
// So does a view whose getter throws when read.
|
||||
ride.subject.hud = Object.defineProperty({ ...HUD }, 'title', {
|
||||
get() {
|
||||
throw new Error('title unavailable');
|
||||
},
|
||||
});
|
||||
clock.advance(200);
|
||||
cockpit.update();
|
||||
await settle();
|
||||
assert.equal(cockpit.active, true);
|
||||
assert.equal($('#cockpit-callsign').textContent, HUD.title, 'last view kept');
|
||||
ride.subject.frame = new Error('read failed');
|
||||
clock.advance(16);
|
||||
cockpit.update();
|
||||
|
||||
Reference in new issue
Block a user