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
19 lines
605 B
TypeScript
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);
|
|
});
|
|
});
|