mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 03:14:00 +00:00
refactor: extract application construction and lifecycle
This commit is contained in:
1 parent
092f28e301
commit
4d37760314
36 files changed
+1363
-382
No files matched your search
@@ -623,3 +623,25 @@ test('a scene run supersedes a LOAD still suspended on its visual await', async
|
||||
restore();
|
||||
}
|
||||
});
|
||||
|
||||
test('destroy drains cancelled LOAD work before its viewer can be discarded', async (t) => {
|
||||
const restore = installSceneRuntime();
|
||||
t.after(restore);
|
||||
let finishVisual;
|
||||
const dataManager = fakeDataManager();
|
||||
const viewer = { camera: { cancelFlight() {} } };
|
||||
const director = new SceneDirector(viewer, {
|
||||
applyVisualState: () => new Promise((resolve) => { finishVisual = resolve; }),
|
||||
}, dataManager);
|
||||
const loading = director.loadShot('scene-1', 'shot-a');
|
||||
let destroyed = false;
|
||||
const stopping = director.destroy().then(() => { destroyed = true; });
|
||||
await Promise.resolve();
|
||||
assert.equal(destroyed, false);
|
||||
finishVisual();
|
||||
await Promise.all([loading, stopping]);
|
||||
assert.equal(destroyed, true);
|
||||
assert.equal(dataManager.setEnabledCalls.length, 0);
|
||||
assert.equal((await director.startScene('scene-1')).reason, 'destroyed');
|
||||
await director.destroy();
|
||||
});
|
||||
Reference in new issue
Block a user