fix: close phase 2 journey blockers
This commit is contained in:
@@ -89,6 +89,51 @@ describe('scene controller lifecycle', () => {
|
||||
expect(harness.generations[0]?.render).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it('samples the complete scene update and render interval', async () => {
|
||||
const harness = createHarness();
|
||||
const renderedFrames: Array<{ start: number; end: number }> = [];
|
||||
const controller = createSceneController({
|
||||
...harness.options,
|
||||
onFrameRendered: (start, end) => renderedFrames.push({ start, end }),
|
||||
});
|
||||
await controller.start();
|
||||
harness.generations[0]?.render.mockImplementation(() => {
|
||||
harness.clock.now += 300;
|
||||
});
|
||||
|
||||
harness.scheduler.flushFrame(2_000);
|
||||
|
||||
expect(renderedFrames).toEqual([{ start: 2_000, end: 2_300 }]);
|
||||
});
|
||||
|
||||
it('retains the same complete generation and frame across a visitor pause', async () => {
|
||||
const harness = createHarness();
|
||||
const controller = createSceneController(harness.options);
|
||||
await controller.start();
|
||||
const running = controller.snapshot();
|
||||
|
||||
controller.pause();
|
||||
|
||||
expect(controller.snapshot()).toMatchObject({
|
||||
state: { kind: 'paused', generation: running.currentGeneration, resumeNeedsLoad: false },
|
||||
currentGeneration: running.currentGeneration,
|
||||
canvasCount: 1,
|
||||
rafCount: 0,
|
||||
});
|
||||
expect(harness.generations).toHaveLength(1);
|
||||
expect(harness.generations[0]?.dispose).not.toHaveBeenCalled();
|
||||
|
||||
await controller.resume();
|
||||
|
||||
expect(controller.snapshot()).toMatchObject({
|
||||
state: { kind: 'running', generation: running.currentGeneration },
|
||||
currentGeneration: running.currentGeneration,
|
||||
canvasCount: 1,
|
||||
rafCount: 1,
|
||||
});
|
||||
expect(harness.generations).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('copies serializable journey snapshots instead of retaining caller objects', async () => {
|
||||
const harness = createHarness();
|
||||
const controller = createSceneController(harness.options);
|
||||
@@ -266,7 +311,15 @@ describe('scene controller lifecycle', () => {
|
||||
await controller.whenSettled();
|
||||
|
||||
expect(controller.snapshot().overlay).toBe('active');
|
||||
if (source === 'running' || source === 'paused') expect(controller.snapshot().state.kind).toBe('running');
|
||||
if (source === 'running') expect(controller.snapshot().state.kind).toBe('running');
|
||||
if (source === 'paused') {
|
||||
expect(controller.snapshot()).toMatchObject({
|
||||
state: { kind: 'paused', generation: 1, resumeNeedsLoad: false },
|
||||
currentGeneration: 1,
|
||||
rafCount: 0,
|
||||
});
|
||||
expect(harness.generations[0]?.dispose).not.toHaveBeenCalled();
|
||||
}
|
||||
if (source === 'loading') expect(harness.buildContexts.length).toBe(beforeShow + 1);
|
||||
if (source === 'static') expect(controller.snapshot().state.kind).toBe('static');
|
||||
if (start && source === 'loading') {
|
||||
|
||||
Reference in New Issue
Block a user