auto-git:

[change] tests/e2e/box-brush-authoring.e2e.ts
 [change] tests/serialization/local-draft-storage.test.ts
This commit is contained in:
2026-03-31 03:46:10 +02:00
parent 667f3ba422
commit fc2fa2e36a
2 changed files with 19 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ test("user can create a box brush and keep it through a draft reload", async ({
await expect(page.getByRole("button", { name: /Box Brush 1/ })).toBeVisible();
await expect(page.getByRole("button", { name: /center 0, 2, 0/ })).toBeVisible();
await expect(page.getByRole("button", { name: /size 2, 2, 4/ })).toBeVisible();
await expect(page.getByText("1 box brushes loaded. Click a brush face in the viewport or use the face selector to texture it.")).toBeVisible();
await expect(page.getByTestId("viewport-overlay")).toBeVisible();
expect(pageErrors).toEqual([]);
expect(consoleErrors).toEqual([]);

View File

@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import { createBoxBrush } from "../../src/document/brushes";
import { SCENE_DOCUMENT_VERSION, createEmptySceneDocument } from "../../src/document/scene-document";
import {
DEFAULT_SCENE_DRAFT_STORAGE_KEY,
@@ -116,4 +117,21 @@ describe("local draft storage", () => {
expect(result.status).toBe("error");
expect(result.message).toContain("quota exceeded");
});
it("refuses to save an invalid scene document draft", () => {
const invalidBrush = createBoxBrush({
id: "brush-invalid"
});
invalidBrush.faces.posX.materialId = "missing-material";
const result = saveSceneDocumentDraft(new MemoryStorage(), {
...createEmptySceneDocument(),
brushes: {
[invalidBrush.id]: invalidBrush
}
});
expect(result.status).toBe("error");
expect(result.message).toContain("validation error");
});
});