mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-15 00:00:44 +00:00
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import {
|
|
createCleanupCommandRuntime,
|
|
resetCleanupCommandMocks,
|
|
silenceCleanupCommandRuntime,
|
|
} from "./cleanup-command.test-support.js";
|
|
|
|
describe("resetCommand", () => {
|
|
const runtime = createCleanupCommandRuntime();
|
|
let resetCommand: typeof import("./reset.js").resetCommand;
|
|
|
|
beforeAll(async () => {
|
|
({ resetCommand } = await import("./reset.js"));
|
|
});
|
|
|
|
beforeEach(() => {
|
|
resetCleanupCommandMocks();
|
|
silenceCleanupCommandRuntime(runtime);
|
|
});
|
|
|
|
it("recommends creating a backup before state-destructive reset scopes", async () => {
|
|
await resetCommand(runtime, {
|
|
scope: "config+creds+sessions",
|
|
yes: true,
|
|
nonInteractive: true,
|
|
dryRun: true,
|
|
});
|
|
|
|
expect(runtime.log).toHaveBeenCalledWith(expect.stringContaining("openclaw backup create"));
|
|
});
|
|
|
|
it("does not recommend backup for config-only reset", async () => {
|
|
await resetCommand(runtime, {
|
|
scope: "config",
|
|
yes: true,
|
|
nonInteractive: true,
|
|
dryRun: true,
|
|
});
|
|
|
|
expect(runtime.log).not.toHaveBeenCalledWith(expect.stringContaining("openclaw backup create"));
|
|
});
|
|
});
|