mirror of https://github.com/openclaw/openclaw.git
test: tighten shared metadata and node resolve coverage
This commit is contained in:
parent
4ecdd7907a
commit
56299effe9
|
|
@ -14,6 +14,15 @@ describe("shared/entry-metadata", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("keeps metadata precedence even when metadata values are blank", () => {
|
||||
expect(
|
||||
resolveEmojiAndHomepage({
|
||||
metadata: { emoji: "", homepage: " " },
|
||||
frontmatter: { emoji: "🙂", homepage: "https://example.com" },
|
||||
}),
|
||||
).toEqual({});
|
||||
});
|
||||
|
||||
it("falls back through frontmatter homepage aliases and drops blanks", () => {
|
||||
expect(
|
||||
resolveEmojiAndHomepage({
|
||||
|
|
@ -29,5 +38,12 @@ describe("shared/entry-metadata", () => {
|
|||
frontmatter: { url: " " },
|
||||
}),
|
||||
).toEqual({});
|
||||
expect(
|
||||
resolveEmojiAndHomepage({
|
||||
frontmatter: { url: " https://openclaw.ai/install " },
|
||||
}),
|
||||
).toEqual({
|
||||
homepage: "https://openclaw.ai/install",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,6 +20,18 @@ describe("shared/node-resolve", () => {
|
|||
).toBe("mac-123");
|
||||
});
|
||||
|
||||
it("passes the original node list to the default picker", () => {
|
||||
expect(
|
||||
resolveNodeIdFromNodeList(nodes, "", {
|
||||
allowDefault: true,
|
||||
pickDefaultNode: (entries) => {
|
||||
expect(entries).toBe(nodes);
|
||||
return entries[1] ?? null;
|
||||
},
|
||||
}),
|
||||
).toBe("pi-456");
|
||||
});
|
||||
|
||||
it("still throws when default selection is disabled or returns null", () => {
|
||||
expect(() => resolveNodeIdFromNodeList(nodes, " ")).toThrow(/node required/);
|
||||
expect(() =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue