test: check cleanup backup prompts · openclaw/openclaw@3ce0b97
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,10 @@ import {
|
5 | 5 | silenceCleanupCommandRuntime, |
6 | 6 | } from "./cleanup-command.test-support.js"; |
7 | 7 | |
| 8 | +function loggedMessages(runtime: ReturnType<typeof createCleanupCommandRuntime>) { |
| 9 | +return runtime.log.mock.calls.map(([message]) => String(message)); |
| 10 | +} |
| 11 | + |
8 | 12 | describe("resetCommand", () => { |
9 | 13 | const runtime = createCleanupCommandRuntime(); |
10 | 14 | let resetCommand: typeof import("./reset.js").resetCommand; |
@@ -26,7 +30,9 @@ describe("resetCommand", () => {
|
26 | 30 | dryRun: true, |
27 | 31 | }); |
28 | 32 | |
29 | | -expect(runtime.log).toHaveBeenCalledWith(expect.stringContaining("openclaw backup create")); |
| 33 | +expect( |
| 34 | +loggedMessages(runtime).some((message) => message.includes("openclaw backup create")), |
| 35 | +).toBe(true); |
30 | 36 | }); |
31 | 37 | |
32 | 38 | it("does not recommend backup for config-only reset", async () => { |
@@ -37,6 +43,8 @@ describe("resetCommand", () => {
|
37 | 43 | dryRun: true, |
38 | 44 | }); |
39 | 45 | |
40 | | -expect(runtime.log).not.toHaveBeenCalledWith(expect.stringContaining("openclaw backup create")); |
| 46 | +expect( |
| 47 | +loggedMessages(runtime).some((message) => message.includes("openclaw backup create")), |
| 48 | +).toBe(false); |
41 | 49 | }); |
42 | 50 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,10 @@ import {
|
5 | 5 | silenceCleanupCommandRuntime, |
6 | 6 | } from "./cleanup-command.test-support.js"; |
7 | 7 | |
| 8 | +function loggedMessages(runtime: ReturnType<typeof createCleanupCommandRuntime>) { |
| 9 | +return runtime.log.mock.calls.map(([message]) => String(message)); |
| 10 | +} |
| 11 | + |
8 | 12 | const { uninstallCommand } = await import("./uninstall.js"); |
9 | 13 | |
10 | 14 | describe("uninstallCommand", () => { |
@@ -23,7 +27,9 @@ describe("uninstallCommand", () => {
|
23 | 27 | dryRun: true, |
24 | 28 | }); |
25 | 29 | |
26 | | -expect(runtime.log).toHaveBeenCalledWith(expect.stringContaining("openclaw backup create")); |
| 30 | +expect( |
| 31 | +loggedMessages(runtime).some((message) => message.includes("openclaw backup create")), |
| 32 | +).toBe(true); |
27 | 33 | }); |
28 | 34 | |
29 | 35 | it("does not recommend backup for service-only uninstall", async () => { |
@@ -34,6 +40,8 @@ describe("uninstallCommand", () => {
|
34 | 40 | dryRun: true, |
35 | 41 | }); |
36 | 42 | |
37 | | -expect(runtime.log).not.toHaveBeenCalledWith(expect.stringContaining("openclaw backup create")); |
| 43 | +expect( |
| 44 | +loggedMessages(runtime).some((message) => message.includes("openclaw backup create")), |
| 45 | +).toBe(false); |
38 | 46 | }); |
39 | 47 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。