mirror of https://github.com/openclaw/openclaw.git
test: tighten shared manifest metadata coverage
This commit is contained in:
parent
25e900f64a
commit
592d93211f
|
|
@ -46,4 +46,16 @@ describe("shared/entry-metadata", () => {
|
||||||
homepage: "https://openclaw.ai/install",
|
homepage: "https://openclaw.ai/install",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not fall back once frontmatter homepage aliases are present but blank", () => {
|
||||||
|
expect(
|
||||||
|
resolveEmojiAndHomepage({
|
||||||
|
frontmatter: {
|
||||||
|
homepage: " ",
|
||||||
|
website: "https://docs.openclaw.ai",
|
||||||
|
url: "https://openclaw.ai/install",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).toEqual({});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -129,4 +129,33 @@ describe("shared/entry-status", () => {
|
||||||
configChecks: [],
|
configChecks: [],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("returns empty requirements when metadata and frontmatter are missing", () => {
|
||||||
|
const result = evaluateEntryMetadataRequirements({
|
||||||
|
always: false,
|
||||||
|
hasLocalBin: () => false,
|
||||||
|
localPlatform: "linux",
|
||||||
|
isEnvSatisfied: () => false,
|
||||||
|
isConfigSatisfied: () => false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
required: {
|
||||||
|
bins: [],
|
||||||
|
anyBins: [],
|
||||||
|
env: [],
|
||||||
|
config: [],
|
||||||
|
os: [],
|
||||||
|
},
|
||||||
|
missing: {
|
||||||
|
bins: [],
|
||||||
|
anyBins: [],
|
||||||
|
env: [],
|
||||||
|
config: [],
|
||||||
|
os: [],
|
||||||
|
},
|
||||||
|
requirementsSatisfied: true,
|
||||||
|
configChecks: [],
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ describe("shared/frontmatter", () => {
|
||||||
expect(parseFrontmatterBool("true", false)).toBe(true);
|
expect(parseFrontmatterBool("true", false)).toBe(true);
|
||||||
expect(parseFrontmatterBool("false", true)).toBe(false);
|
expect(parseFrontmatterBool("false", true)).toBe(false);
|
||||||
expect(parseFrontmatterBool(undefined, true)).toBe(true);
|
expect(parseFrontmatterBool(undefined, true)).toBe(true);
|
||||||
|
expect(parseFrontmatterBool("maybe", false)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("resolveOpenClawManifestBlock reads current manifest keys and custom metadata fields", () => {
|
test("resolveOpenClawManifestBlock reads current manifest keys and custom metadata fields", () => {
|
||||||
|
|
@ -53,6 +54,8 @@ describe("shared/frontmatter", () => {
|
||||||
expect(
|
expect(
|
||||||
resolveOpenClawManifestBlock({ frontmatter: { metadata: "not-json5" } }),
|
resolveOpenClawManifestBlock({ frontmatter: { metadata: "not-json5" } }),
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
|
expect(resolveOpenClawManifestBlock({ frontmatter: { metadata: "123" } })).toBeUndefined();
|
||||||
|
expect(resolveOpenClawManifestBlock({ frontmatter: { metadata: "[]" } })).toBeUndefined();
|
||||||
expect(
|
expect(
|
||||||
resolveOpenClawManifestBlock({ frontmatter: { metadata: "{ nope: { a: 1 } }" } }),
|
resolveOpenClawManifestBlock({ frontmatter: { metadata: "{ nope: { a: 1 } }" } }),
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
|
|
@ -120,6 +123,40 @@ describe("shared/frontmatter", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("prefers explicit kind, ignores invalid common fields, and leaves missing ones untouched", () => {
|
||||||
|
const parsed = parseOpenClawManifestInstallBase(
|
||||||
|
{
|
||||||
|
kind: " npm ",
|
||||||
|
type: "brew",
|
||||||
|
id: 42,
|
||||||
|
label: null,
|
||||||
|
bins: [" ", ""],
|
||||||
|
},
|
||||||
|
["brew", "npm"],
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(parsed).toEqual({
|
||||||
|
raw: {
|
||||||
|
kind: " npm ",
|
||||||
|
type: "brew",
|
||||||
|
id: 42,
|
||||||
|
label: null,
|
||||||
|
bins: [" ", ""],
|
||||||
|
},
|
||||||
|
kind: "npm",
|
||||||
|
});
|
||||||
|
expect(
|
||||||
|
applyOpenClawManifestInstallCommonFields(
|
||||||
|
{ id: "keep", label: "Keep", bins: ["bun"] },
|
||||||
|
parsed!,
|
||||||
|
),
|
||||||
|
).toEqual({
|
||||||
|
id: "keep",
|
||||||
|
label: "Keep",
|
||||||
|
bins: ["bun"],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("maps install entries through the parser and filters rejected specs", () => {
|
it("maps install entries through the parser and filters rejected specs", () => {
|
||||||
expect(
|
expect(
|
||||||
resolveOpenClawManifestInstall(
|
resolveOpenClawManifestInstall(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue