feat: 分离模板演示数据并校验预览资源
This commit is contained in:
1 parent
6edde5a8d6
commit
b60174885e
31 files changed
+1785
-69
No files matched your search
@@ -8,6 +8,45 @@ import { runtimeContractForBinding } from "../../types/src/runtime-content-contr
|
||||
|
||||
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
|
||||
test("independent preview fixtures validate safety and industry without changing bootstrap content", () => {
|
||||
const manifest = JSON.parse(
|
||||
fs.readFileSync(path.join(packageRoot, "template-atelier-solopreneur/template.json"), "utf8"),
|
||||
);
|
||||
assert.deepEqual(validateTemplatePackageManifest(manifest), []);
|
||||
assert.notEqual(
|
||||
manifest.previewFixture.personal.content.brandConfig.founder,
|
||||
manifest.sampleContent.personal.brandConfig.founder,
|
||||
);
|
||||
for (const mutate of [
|
||||
(value) => {
|
||||
value.previewFixture.personal.safety.submissions = "enabled";
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture.personal.brand.contactPhone = "13800000000";
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture.personal.content.fields = [null];
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture.personal.content.templateKey = "food";
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture = [];
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture.personal = null;
|
||||
},
|
||||
]) {
|
||||
const invalid = structuredClone(manifest);
|
||||
mutate(invalid);
|
||||
assert.ok(
|
||||
validateTemplatePackageManifest(invalid).some((message) =>
|
||||
message.startsWith("previewFixture"),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
for (const key of ["acheng-campus-food", "linjing-editorial"]) {
|
||||
test(`${key} declares valid admin content and asset requirements`, () => {
|
||||
const manifestPath = path.join(packageRoot, `template-${key}`, "template.json");
|
||||
|
||||
Reference in new issue
Block a user