mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
e07b81649e
* fix(hopper): report unavailable procedure body coverage * refactor!: simplify runtime tools and remove replay engines Keep direct inspection, capture, and comparison tools. Bind handlers to named contracts and let agents compose experiments with commands and local fixture servers. BREAKING CHANGE: Remove controlled replay, Node characterization, finite replay-machine, managed runtime planning, and redundant string-tracing tools. Retire process replay, shims, reactive scenarios, custom checkpoints, and active browser replay and origin-scope inputs.
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { scheduleProcessDelay } from "./ProcessTimer.js";
|
|
|
|
describe("process delay scheduling", () => {
|
|
it("splits long delays into timer-sized chunks and can cancel the next chunk", () => {
|
|
const scheduled: Array<{
|
|
readonly delayMs: number;
|
|
readonly callback: () => void;
|
|
cancelled: boolean;
|
|
}> = [];
|
|
const schedule = (callback: () => void, delayMs: number) => {
|
|
const entry = { delayMs, callback, cancelled: false };
|
|
scheduled.push(entry);
|
|
return { cancel: () => (entry.cancelled = true) };
|
|
};
|
|
let fired = false;
|
|
const timer = scheduleProcessDelay(
|
|
2_147_483_647 + 25,
|
|
() => {
|
|
fired = true;
|
|
},
|
|
schedule,
|
|
);
|
|
|
|
expect(scheduled.map(({ delayMs }) => delayMs)).toEqual([2_147_483_647]);
|
|
scheduled[0]?.callback();
|
|
expect(scheduled.map(({ delayMs }) => delayMs)).toEqual([
|
|
2_147_483_647, 25,
|
|
]);
|
|
expect(fired).toBe(false);
|
|
|
|
timer.cancel();
|
|
expect(scheduled[1]?.cancelled).toBe(true);
|
|
scheduled[1]?.callback();
|
|
expect(fired).toBe(false);
|
|
});
|
|
});
|