openclaw/src/process/restart-recovery.test.ts
Joseph Krug 4e9f933e88
fix: reset stale execution state after SIGUSR1 in-process restart (#15195)
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 676f9ec45135be0d3471bb0444bc2ac7ce7d5224
Co-authored-by: joeykrug <5925937+joeykrug@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
2026-02-13 15:30:09 -05:00

19 lines
605 B
TypeScript

import { describe, expect, it, vi } from "vitest";
import { createRestartIterationHook } from "./restart-recovery.js";
describe("restart-recovery", () => {
it("skips recovery on first iteration and runs on subsequent iterations", () => {
const onRestart = vi.fn();
const onIteration = createRestartIterationHook(onRestart);
expect(onIteration()).toBe(false);
expect(onRestart).not.toHaveBeenCalled();
expect(onIteration()).toBe(true);
expect(onRestart).toHaveBeenCalledTimes(1);
expect(onIteration()).toBe(true);
expect(onRestart).toHaveBeenCalledTimes(2);
});
});