mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:01:22 +00:00
chore: merge origin/main into main
This commit is contained in:
@@ -116,6 +116,40 @@ describe("buildBootstrapContextFiles", () => {
|
||||
expect(result[0]?.content.length).toBeLessThanOrEqual(20);
|
||||
expect(result[0]?.content.startsWith("[MISSING]")).toBe(true);
|
||||
});
|
||||
|
||||
it("skips files with missing or invalid paths and emits warnings", () => {
|
||||
const malformedMissingPath = {
|
||||
name: "SKILL-SECURITY.md",
|
||||
missing: false,
|
||||
content: "secret",
|
||||
} as unknown as WorkspaceBootstrapFile;
|
||||
const malformedNonStringPath = {
|
||||
name: "SKILL-SECURITY.md",
|
||||
path: 123,
|
||||
missing: false,
|
||||
content: "secret",
|
||||
} as unknown as WorkspaceBootstrapFile;
|
||||
const malformedWhitespacePath = {
|
||||
name: "SKILL-SECURITY.md",
|
||||
path: " ",
|
||||
missing: false,
|
||||
content: "secret",
|
||||
} as unknown as WorkspaceBootstrapFile;
|
||||
const good = makeFile({ content: "hello" });
|
||||
const warnings: string[] = [];
|
||||
const result = buildBootstrapContextFiles(
|
||||
[malformedMissingPath, malformedNonStringPath, malformedWhitespacePath, good],
|
||||
{
|
||||
warn: (msg) => warnings.push(msg),
|
||||
},
|
||||
);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0]?.path).toBe("/tmp/AGENTS.md");
|
||||
expect(warnings).toHaveLength(3);
|
||||
expect(warnings.every((warning) => warning.includes('missing or invalid "path" field'))).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
type BootstrapLimitResolverCase = {
|
||||
|
||||
Reference in New Issue
Block a user