mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 02:50:24 +00:00
test(cron): stabilize regression harness
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { vi, type Mock } from "vitest";
|
||||
import { resolveFastModeState as resolveFastModeStateImpl } from "../../agents/fast-mode.js";
|
||||
import { LiveSessionModelSwitchError } from "../../agents/live-model-switch-error.js";
|
||||
|
||||
type CronSessionEntry = {
|
||||
@@ -237,7 +238,7 @@ export function resetRunCronIsolatedAgentTurnHarness(): void {
|
||||
formattedTime: "2026-02-10 12:00",
|
||||
timeLine: "Current time: 2026-02-10 12:00 UTC",
|
||||
});
|
||||
resolveFastModeStateMock.mockReturnValue({ enabled: false });
|
||||
resolveFastModeStateMock.mockImplementation((params) => resolveFastModeStateImpl(params));
|
||||
resolveNestedAgentLaneMock.mockReturnValue(undefined);
|
||||
resolveAgentTimeoutMsMock.mockReturnValue(60_000);
|
||||
deriveSessionTotalTokensMock.mockReturnValue(30);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import fs from "node:fs/promises";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { clearCommandLane, setCommandLaneConcurrency } from "../../process/command-queue.js";
|
||||
import {
|
||||
clearCommandLane,
|
||||
setCommandLaneConcurrency,
|
||||
waitForActiveTasks,
|
||||
} from "../../process/command-queue.js";
|
||||
import { CommandLane } from "../../process/lanes.js";
|
||||
import {
|
||||
createAbortAwareIsolatedRunner,
|
||||
@@ -351,6 +355,7 @@ describe("cron service ops regressions", () => {
|
||||
|
||||
secondRun.resolve({ status: "ok", summary: "second queued run" });
|
||||
await bothFinished.promise;
|
||||
await waitForActiveTasks(5_000);
|
||||
const jobs = state.store?.jobs ?? [];
|
||||
expect(jobs.find((job) => job.id === first.id)?.state.lastStatus).toBe("ok");
|
||||
expect(jobs.find((job) => job.id === second.id)?.state.lastStatus).toBe("ok");
|
||||
|
||||
Reference in New Issue
Block a user