feat: 完善模板驱动的品牌内容工作台
This commit is contained in:
1 parent
77224ea51f
commit
dd55af8d73
46 files changed
+2204
-295
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import test from "node:test";
|
||||
import { validateTemplatePackageManifest } from "../src/index.ts";
|
||||
|
||||
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
|
||||
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");
|
||||
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
||||
assert.deepEqual(validateTemplatePackageManifest(manifest), []);
|
||||
});
|
||||
}
|
||||
|
||||
test("template contract rejects technical or incomplete admin declarations", () => {
|
||||
const manifestPath = path.join(packageRoot, "template-acheng-campus-food/template.json");
|
||||
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
||||
manifest.admin.sections[0].fields[0].label = "";
|
||||
manifest.assetSlots[0].help = "";
|
||||
assert.deepEqual(validateTemplatePackageManifest(manifest), [
|
||||
"every asset slot requires key, binding, label and help",
|
||||
"every admin field requires key, binding and label",
|
||||
]);
|
||||
});
|
||||
Reference in new issue
Block a user