From 1b101c28894bb426092e2dec1d94c3744f0fa768 Mon Sep 17 00:00:00 2001 From: Void Date: Sat, 14 Nov 2026 02:27:25 +0000 Subject: [PATCH] Scene sky-change sweep: bake each state's sky once so the test stays inside its timeout under load Co-Authored-By: Claude Sonnet 5.5 --- src/app/features/scene/index.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/app/features/scene/index.test.ts b/src/app/features/scene/index.test.ts index 5574d60c..71769f5c 100644 --- a/src/app/features/scene/index.test.ts +++ b/src/app/features/scene/index.test.ts @@ -11,6 +11,21 @@ const { createRidgeScene, createScene } = vi.hoisted(() => ({ })); vi.mock('./ridge/Ridge', () => ({ createRidgeScene })); vi.mock('./Scene', () => ({ createScene })); +// The physical sky is baked per call (tens of ms: atmosphere LUTs) and the clock here is fixed, so a state always +// draws the same sky. Baking once per state keeps the 21-offset sweep under the default timeout when the machine is +// loaded; the sky each build receives is still the one `ridgeSkyFor` makes for that state. +vi.mock('./skyForState', async (importOriginal) => { + const actual = await importOriginal(); + const baked = new Map>(); + return { + ...actual, + ridgeSkyFor: (...args: Parameters) => { + if (args.length !== 1) return actual.ridgeSkyFor(...args); + if (!baked.has(args[0])) baked.set(args[0], actual.ridgeSkyFor(args[0])); + return baked.get(args[0]) as ReturnType; + }, + }; +}); const canvas = {} as HTMLCanvasElement; const config = { tier: 'low' as const };