refactor(update-cli): share timeout option validation
This commit is contained in:
@@ -557,6 +557,16 @@ describe("update-cli", () => {
|
||||
expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
||||
it("updateStatusCommand validates timeout option", async () => {
|
||||
vi.mocked(defaultRuntime.error).mockClear();
|
||||
vi.mocked(defaultRuntime.exit).mockClear();
|
||||
|
||||
await updateStatusCommand({ timeout: "invalid" });
|
||||
|
||||
expect(defaultRuntime.error).toHaveBeenCalledWith(expect.stringContaining("timeout"));
|
||||
expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
||||
it("persists update channel when --channel is set", async () => {
|
||||
const mockResult: UpdateRunResult = {
|
||||
status: "ok",
|
||||
@@ -611,6 +621,17 @@ describe("update-cli", () => {
|
||||
expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
||||
it("updateWizardCommand validates timeout option", async () => {
|
||||
setTty(true);
|
||||
vi.mocked(defaultRuntime.error).mockClear();
|
||||
vi.mocked(defaultRuntime.exit).mockClear();
|
||||
|
||||
await updateWizardCommand({ timeout: "invalid" });
|
||||
|
||||
expect(defaultRuntime.error).toHaveBeenCalledWith(expect.stringContaining("timeout"));
|
||||
expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
||||
it("updateWizardCommand offers dev checkout and forwards selections", async () => {
|
||||
const tempDir = await createCaseDir("openclaw-update-wizard");
|
||||
const envSnapshot = captureEnv(["OPENCLAW_GIT_DIR"]);
|
||||
|
||||
Reference in New Issue
Block a user