UI 编辑器桥接用例改回真实成功路径

- apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts:`ensure_ui_design_resource_for_prototype` 的 mock 从返回 `null` 改为返回真实形状的桥接结果(asset + manifest + committedProjectRevision + created),并新增 `data-resource-view-state === 'resources.ui-editor'` 断言,让用例真的覆盖它名字里的成功路径而不是被组件吞进错误分支。
This commit is contained in:
2026-09-17 16:19:38 +08:00
parent 04e5512777
commit 20b34918d3
@@ -6566,7 +6566,32 @@ export function registerProjectWorkbenchFoundationTests() {
};
}
if (command === 'ensure_ui_design_resource_for_prototype') {
return null;
// 必须返回真实形状的成功结果:返回 `null` 会让 `result.manifest.projectId`
// 抛 TypeError 并被组件吞进错误分支,用例就永远测不到它名字里的成功路径。
return {
asset: {
id: 'ui-design-doc',
kind: GAME_CREATION_APP_UI_DESIGN_DOC_ASSET_KIND,
mediaType: GAME_CREATION_APP_UI_DESIGN_DOC_MEDIA_TYPE,
localPath: 'assets/ui-design.json',
source: { kind: 'generated' as const },
},
manifest: {
...manifest,
assets: [
...manifest.assets,
{
id: 'ui-design-doc',
kind: GAME_CREATION_APP_UI_DESIGN_DOC_ASSET_KIND,
mediaType: GAME_CREATION_APP_UI_DESIGN_DOC_MEDIA_TYPE,
localPath: 'assets/ui-design.json',
source: { kind: 'generated' as const },
},
],
},
committedProjectRevision: 1,
created: true,
};
}
throw new Error(`unexpected invoke ${command}`);
},
@@ -6599,6 +6624,15 @@ export function registerProjectWorkbenchFoundationTests() {
}),
}),
);
// 成功路径:桥接结果被接受后画布切到 UI 编辑器视图;走错误分支时会停在
// `resources.selected.*` 并在提示条上留下原因,这条断言让用例真的覆盖它名字里的事。
await waitFor(() =>
expect(
screen
.getByLabelText('项目主视窗')
.getAttribute('data-resource-view-state'),
).toBe('resources.ui-editor'),
);
});
it('refuses to embed a non-loopback game preview in the client workbench', () => {