test: reset cron regression command queue state

This commit is contained in:
Shakker
2026-04-02 01:23:58 +01:00
committed by Peter Steinberger
parent 8bd3067e69
commit dcc3467a2b
2 changed files with 4 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, vi } from "vitest";
import { clearAllBootstrapSnapshots } from "../agents/bootstrap-cache.js";
import { clearSessionStoreCacheForTest } from "../config/sessions/store.js";
import { resetAgentRunContextForTest } from "../infra/agent-events.js";
import { resetCommandQueueStateForTest } from "../process/command-queue.js";
import { useFrozenTime, useRealTime } from "../test-utils/frozen-time.js";
import { createCronServiceState, type CronServiceDeps } from "./service/state.js";
import type { CronJob, CronJobState } from "./types.js";
@@ -29,6 +30,7 @@ export function setupCronRegressionFixtures(options?: { prefix?: string; baseTim
});
beforeEach(() => {
resetCommandQueueStateForTest();
useFrozenTime(options?.baseTimeIso ?? "2026-02-06T10:05:00.000Z");
});
@@ -36,6 +38,7 @@ export function setupCronRegressionFixtures(options?: { prefix?: string; baseTim
vi.clearAllTimers();
vi.restoreAllMocks();
useRealTime();
resetCommandQueueStateForTest();
clearSessionStoreCacheForTest();
resetAgentRunContextForTest();
clearAllBootstrapSnapshots();

View File

@@ -366,7 +366,7 @@ describe("cron service ops regressions", () => {
const errorLogged = createDeferred<void>();
const log = {
...noopLogger,
error: vi.fn(() => {
error: vi.fn<(payload: unknown, message?: string) => void>(() => {
errorLogged.resolve();
}),
};