
























@@ -89,8 +89,9 @@ async function createHeartbeatAgentsWorkspace() {
8989}
90909191function expectHeartbeatExcludedAndAgentsKept(files: WorkspaceBootstrapFile[]) {
92-expect(files.some((file) => file.name === "HEARTBEAT.md")).toBe(false);
93-expect(files.some((file) => file.name === "AGENTS.md")).toBe(true);
92+const fileNames = files.map((file) => file.name);
93+expect(fileNames).not.toContain("HEARTBEAT.md");
94+expect(fileNames).toContain("AGENTS.md");
9495}
95969697describe("resolveBootstrapFilesForRun", () => {
@@ -103,7 +104,8 @@ describe("resolveBootstrapFilesForRun", () => {
103104const workspaceDir = await makeTempWorkspace("openclaw-bootstrap-");
104105const files = await resolveBootstrapFilesForRun({ workspaceDir });
105106106-expect(files.some((file) => file.path === path.join(workspaceDir, "EXTRA.md"))).toBe(true);
107+const filePaths = files.map((file) => file.path);
108+expect(filePaths).toContain(path.join(workspaceDir, "EXTRA.md"));
107109});
108110109111it("drops malformed hook files with missing/invalid paths", async () => {
@@ -166,9 +168,10 @@ describe("resolveBootstrapContextForRun", () => {
166168167169const result = await resolveBootstrapContextForRun({ workspaceDir });
168170169-expect(result.bootstrapFiles.some((file) => file.name === "BOOTSTRAP.md")).toBe(true);
170-expect(result.contextFiles.some((file) => file.path.endsWith("BOOTSTRAP.md"))).toBe(true);
171-expect(result.contextFiles.some((file) => file.path.endsWith("AGENTS.md"))).toBe(true);
171+const bootstrapFileNames = result.bootstrapFiles.map((file) => file.name);
172+expect(bootstrapFileNames).toContain("BOOTSTRAP.md");
173+const contextFileNames = result.contextFiles.map((file) => path.basename(file.path));
174+expect(contextFileNames).toEqual(expect.arrayContaining(["BOOTSTRAP.md", "AGENTS.md"]));
172175});
173176174177it("uses heartbeat-only bootstrap files in lightweight heartbeat mode", async () => {
@@ -183,7 +186,8 @@ describe("resolveBootstrapContextForRun", () => {
183186});
184187185188expect(files.length).toBeGreaterThan(0);
186-expect(files.every((file) => file.name === "HEARTBEAT.md")).toBe(true);
189+const nonHeartbeatFiles = files.filter((file) => file.name !== "HEARTBEAT.md");
190+expect(nonHeartbeatFiles).toEqual([]);
187191});
188192189193it("keeps bootstrap context empty in lightweight cron mode", async () => {
@@ -258,7 +262,8 @@ describe("resolveBootstrapContextForRun", () => {
258262},
259263});
260264261-expect(files.some((file) => file.name === "HEARTBEAT.md")).toBe(true);
265+const fileNames = files.map((file) => file.name);
266+expect(fileNames).toContain("HEARTBEAT.md");
262267});
263268});
264269此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。