diff --git a/tests/domain/create-empty-scene-document.test.ts b/tests/domain/create-empty-scene-document.test.ts index f50f9bc6..4572dc06 100644 --- a/tests/domain/create-empty-scene-document.test.ts +++ b/tests/domain/create-empty-scene-document.test.ts @@ -9,6 +9,25 @@ describe("createEmptySceneDocument", () => { expect(document.version).toBe(SCENE_DOCUMENT_VERSION); expect(document.name).toBe("Untitled Scene"); + expect(document.world).toEqual({ + background: { + mode: "solid", + colorHex: "#2f3947" + }, + ambientLight: { + colorHex: "#f7f1e8", + intensity: 1 + }, + sunLight: { + colorHex: "#fff1d5", + intensity: 1.75, + direction: { + x: -0.6, + y: 1, + z: 0.35 + } + } + }); expect(document.brushes).toEqual({}); expect(document.entities).toEqual({}); expect(document.modelInstances).toEqual({}); diff --git a/tests/domain/scene-document-validation.test.ts b/tests/domain/scene-document-validation.test.ts index e2348647..36c87ea4 100644 --- a/tests/domain/scene-document-validation.test.ts +++ b/tests/domain/scene-document-validation.test.ts @@ -116,4 +116,38 @@ describe("validateSceneDocument", () => { ]) ); }); + + it("detects invalid world lighting and background settings", () => { + const document = createEmptySceneDocument(); + document.world.background = { + mode: "verticalGradient", + topColorHex: "sky-blue", + bottomColorHex: "#18212b" + }; + document.world.ambientLight.intensity = -0.25; + document.world.sunLight.direction = { + x: 0, + y: 0, + z: 0 + }; + + const validation = validateSceneDocument(document); + + expect(validation.errors).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + code: "invalid-world-background-top-color", + path: "world.background.topColorHex" + }), + expect.objectContaining({ + code: "invalid-world-ambient-intensity", + path: "world.ambientLight.intensity" + }), + expect.objectContaining({ + code: "invalid-world-sun-direction", + path: "world.sunLight.direction" + }) + ]) + ); + }); });