From caa53e55ffedfe905c534d01e6ce4c44a25970fe Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Sat, 23 May 2026 23:55:00 +0800 Subject: [PATCH] chore(test): format golden fixtures --- .../fixtures/docs/edge-section-padding.json | 8 +-- .../docs/excessive-frame-effects.json | 54 ++++++++++++++++--- .../fixtures/docs/invisible-container.json | 8 +-- .../docs/stacked-horizontal-padding.json | 8 +-- .../fixtures/golden/edge-section-padding.json | 7 +-- .../golden/stacked-horizontal-padding.json | 7 +-- .../tests/planner-golden/cases.json | 12 ++--- .../tools/dump-planner-golden.ts | 8 ++- 8 files changed, 66 insertions(+), 46 deletions(-) diff --git a/crates/op-design-lint/tests/fixtures/docs/edge-section-padding.json b/crates/op-design-lint/tests/fixtures/docs/edge-section-padding.json index b5095ac5f..e2f0f13c5 100644 --- a/crates/op-design-lint/tests/fixtures/docs/edge-section-padding.json +++ b/crates/op-design-lint/tests/fixtures/docs/edge-section-padding.json @@ -13,18 +13,14 @@ "id": "categories", "role": "categories", "layout": "vertical", - "children": [ - { "type": "text", "id": "cat-label", "content": "Categories" } - ] + "children": [{ "type": "text", "id": "cat-label", "content": "Categories" }] }, { "type": "frame", "id": "list", "role": "list", "layout": "vertical", - "children": [ - { "type": "text", "id": "list-item", "content": "First item" } - ] + "children": [{ "type": "text", "id": "list-item", "content": "First item" }] } ] } diff --git a/crates/op-design-lint/tests/fixtures/docs/excessive-frame-effects.json b/crates/op-design-lint/tests/fixtures/docs/excessive-frame-effects.json index bc254a5c4..a51d98d4c 100644 --- a/crates/op-design-lint/tests/fixtures/docs/excessive-frame-effects.json +++ b/crates/op-design-lint/tests/fixtures/docs/excessive-frame-effects.json @@ -10,30 +10,72 @@ "type": "frame", "id": "stacked-effects", "effects": [ - { "type": "shadow", "offsetX": 0, "offsetY": 1, "blur": 4, "spread": 0, "color": "#000000" }, - { "type": "shadow", "offsetX": 0, "offsetY": 2, "blur": 8, "spread": 0, "color": "#000000" }, - { "type": "shadow", "offsetX": 0, "offsetY": 4, "blur": 12, "spread": 0, "color": "#000000" } + { + "type": "shadow", + "offsetX": 0, + "offsetY": 1, + "blur": 4, + "spread": 0, + "color": "#000000" + }, + { + "type": "shadow", + "offsetX": 0, + "offsetY": 2, + "blur": 8, + "spread": 0, + "color": "#000000" + }, + { + "type": "shadow", + "offsetX": 0, + "offsetY": 4, + "blur": 12, + "spread": 0, + "color": "#000000" + } ] }, { "type": "frame", "id": "halo-blur", "effects": [ - { "type": "shadow", "offsetX": 0, "offsetY": 0, "blur": 64, "spread": 0, "color": "#000000" } + { + "type": "shadow", + "offsetX": 0, + "offsetY": 0, + "blur": 64, + "spread": 0, + "color": "#000000" + } ] }, { "type": "frame", "id": "spiked-spread", "effects": [ - { "type": "shadow", "offsetX": 0, "offsetY": 2, "blur": 16, "spread": 8, "color": "#000000" } + { + "type": "shadow", + "offsetX": 0, + "offsetY": 2, + "blur": 16, + "spread": 8, + "color": "#000000" + } ] }, { "type": "frame", "id": "subtle-shadow", "effects": [ - { "type": "shadow", "offsetX": 0, "offsetY": 2, "blur": 16, "spread": 0, "color": "#000000" } + { + "type": "shadow", + "offsetX": 0, + "offsetY": 2, + "blur": 16, + "spread": 0, + "color": "#000000" + } ] } ] diff --git a/crates/op-design-lint/tests/fixtures/docs/invisible-container.json b/crates/op-design-lint/tests/fixtures/docs/invisible-container.json index f09c2ac45..52780553a 100644 --- a/crates/op-design-lint/tests/fixtures/docs/invisible-container.json +++ b/crates/op-design-lint/tests/fixtures/docs/invisible-container.json @@ -12,9 +12,7 @@ "id": "light-on-light", "layout": "vertical", "fill": [{ "type": "solid", "color": "#FFFFFF" }], - "children": [ - { "type": "text", "id": "lol-label", "content": "Inside light wrapper" } - ] + "children": [{ "type": "text", "id": "lol-label", "content": "Inside light wrapper" }] }, { "type": "frame", @@ -27,9 +25,7 @@ "id": "dark-on-dark", "layout": "vertical", "fill": [{ "type": "solid", "color": "#0A0A0A" }], - "children": [ - { "type": "text", "id": "dod-label", "content": "Inside dark wrapper" } - ] + "children": [{ "type": "text", "id": "dod-label", "content": "Inside dark wrapper" }] } ] } diff --git a/crates/op-design-lint/tests/fixtures/docs/stacked-horizontal-padding.json b/crates/op-design-lint/tests/fixtures/docs/stacked-horizontal-padding.json index 3c65e995a..4869352c5 100644 --- a/crates/op-design-lint/tests/fixtures/docs/stacked-horizontal-padding.json +++ b/crates/op-design-lint/tests/fixtures/docs/stacked-horizontal-padding.json @@ -15,18 +15,14 @@ "role": "section", "layout": "vertical", "padding": [0, 24, 0, 24], - "children": [ - { "type": "text", "id": "specials-title", "content": "Today's Specials" } - ] + "children": [{ "type": "text", "id": "specials-title", "content": "Today's Specials" }] }, { "type": "frame", "id": "menu", "role": "section", "layout": "vertical", - "children": [ - { "type": "text", "id": "menu-title", "content": "Menu" } - ] + "children": [{ "type": "text", "id": "menu-title", "content": "Menu" }] } ] } diff --git a/crates/op-design-lint/tests/fixtures/golden/edge-section-padding.json b/crates/op-design-lint/tests/fixtures/golden/edge-section-padding.json index 9158694df..7ced3d384 100644 --- a/crates/op-design-lint/tests/fixtures/golden/edge-section-padding.json +++ b/crates/op-design-lint/tests/fixtures/golden/edge-section-padding.json @@ -5,12 +5,7 @@ "severity": "warning", "property": "padding", "currentValue": null, - "suggestedValue": [ - 0, - 16, - 0, - 16 - ], + "suggestedValue": [0, 16, 0, 16], "reason": "mobile root has 0 horizontal padding while 2 content section(s) glue text/icon to screen edge" } ] diff --git a/crates/op-design-lint/tests/fixtures/golden/stacked-horizontal-padding.json b/crates/op-design-lint/tests/fixtures/golden/stacked-horizontal-padding.json index c42bd069d..066f706c1 100644 --- a/crates/op-design-lint/tests/fixtures/golden/stacked-horizontal-padding.json +++ b/crates/op-design-lint/tests/fixtures/golden/stacked-horizontal-padding.json @@ -4,12 +4,7 @@ "category": "stacked-horizontal-padding", "severity": "info", "property": "padding", - "currentValue": [ - 0, - 24, - 0, - 24 - ], + "currentValue": [0, 24, 0, 24], "suggestedValue": null, "reason": "section h-padding [24/24] stacks with root h-padding [16/16] — combined gutter 40/40" } diff --git a/crates/op-orchestrator/tests/planner-golden/cases.json b/crates/op-orchestrator/tests/planner-golden/cases.json index 255f13072..8ea96d23c 100644 --- a/crates/op-orchestrator/tests/planner-golden/cases.json +++ b/crates/op-orchestrator/tests/planner-golden/cases.json @@ -1,10 +1,6 @@ [ - { "name": "compact-mobile-login", "fn": "compact", - "prompt": "a mobile login screen" }, - { "name": "compact-fintech-landing", "fn": "compact", - "prompt": "a fintech marketing site" }, - { "name": "compact-dashboard", "fn": "compact", - "prompt": "an analytics admin dashboard" }, - { "name": "compact-component", "fn": "compact", - "prompt": "a pricing card" } + { "name": "compact-mobile-login", "fn": "compact", "prompt": "a mobile login screen" }, + { "name": "compact-fintech-landing", "fn": "compact", "prompt": "a fintech marketing site" }, + { "name": "compact-dashboard", "fn": "compact", "prompt": "an analytics admin dashboard" }, + { "name": "compact-component", "fn": "compact", "prompt": "a pricing card" } ] diff --git a/crates/op-orchestrator/tools/dump-planner-golden.ts b/crates/op-orchestrator/tools/dump-planner-golden.ts index 3c7694208..1594a4b37 100644 --- a/crates/op-orchestrator/tools/dump-planner-golden.ts +++ b/crates/op-orchestrator/tools/dump-planner-golden.ts @@ -6,14 +6,18 @@ import { buildCompactPlanningPrompt } from '../../../apps/web/src/services/ai/or const dir = join(import.meta.dir, '../tests/planner-golden'); const cases = JSON.parse(readFileSync(join(dir, 'cases.json'), 'utf8')) as Array<{ - name: string; fn: string; prompt: string; + name: string; + fn: string; + prompt: string; }>; let written = 0; for (const c of cases) { if (c.fn === 'compact') { const { systemPrompt, userPrompt, selectedStyleGuideName } = buildCompactPlanningPrompt( - c.prompt, undefined, undefined, + c.prompt, + undefined, + undefined, ); writeFileSync( join(dir, `${c.name}.json`),