test: 修复浏览器回归 fixture 契约漂移
- 补齐 trust content 与模板版本 fixture 的必填字段\n- mock template-operations/failures 的完整响应结构\n- 补全完整浏览器回归的启动步骤与 CORS 要求\n\n完整回归 32 个用例全部通过。
This commit is contained in:
1 parent
18bcdbeb00
commit
84522a8908
5 files changed
+65
-6
No files matched your search
@@ -18,12 +18,15 @@ type PackedChecksums = {
|
||||
|
||||
type PreviewVersion = {
|
||||
id: string;
|
||||
templatePackageId: string;
|
||||
packageKey: string;
|
||||
version: string;
|
||||
displayName: string;
|
||||
status: "imported";
|
||||
manifestSnapshot: PackedManifest;
|
||||
importedBy: { displayName: string };
|
||||
importedBy: { id: string; username: string; displayName: string };
|
||||
importedAt: string;
|
||||
updatedAt: string;
|
||||
validationReport: Record<string, unknown>;
|
||||
manifestSummary: { supportedIndustryTemplates: string[] };
|
||||
artifactPath: string;
|
||||
@@ -88,12 +91,15 @@ async function buildPreviewFixture(mediaCase: MediaCase) {
|
||||
const archivePath = path.join(temporary, archive);
|
||||
const version: PreviewVersion = {
|
||||
id: `preview-media-${mediaCase.packageKey}-${mediaCase.industry}`,
|
||||
templatePackageId: `preview-media-package-${mediaCase.packageKey}`,
|
||||
packageKey: manifest.packageKey,
|
||||
version: manifest.version,
|
||||
displayName: manifest.displayName,
|
||||
status: "imported",
|
||||
manifestSnapshot: manifest,
|
||||
importedBy: { displayName: "模板管理员" },
|
||||
importedBy: { id: "template-admin", username: "admin", displayName: "模板管理员" },
|
||||
importedAt: "2026-10-21T00:00:00.000Z",
|
||||
updatedAt: "2026-10-21T00:00:00.000Z",
|
||||
validationReport: {},
|
||||
manifestSummary: { supportedIndustryTemplates: manifest.supportedIndustryTemplates },
|
||||
artifactPath: archivePath,
|
||||
@@ -216,6 +222,16 @@ test("导入包预览矩阵展示身份、资源和完整媒体槽位", async ({
|
||||
total: 1,
|
||||
},
|
||||
});
|
||||
if (url.pathname.endsWith("/admin/template-operations/failures"))
|
||||
return route.fulfill({
|
||||
json: {
|
||||
since: "2026-09-21T00:00:00.000Z",
|
||||
until: "2026-10-21T00:00:00.000Z",
|
||||
days: 30,
|
||||
backfilled: true,
|
||||
failures: [],
|
||||
},
|
||||
});
|
||||
if (url.pathname.endsWith("/admin/brands")) return route.fulfill({ json: [] });
|
||||
return route.fulfill({ json: { name: "测试工作区" } });
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user