From 8a07ac510b4012c04445455314e07697db3dc9eb Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 9 Apr 2026 08:23:48 +0100 Subject: [PATCH] test: isolate tasks reply registry state --- src/auto-reply/reply/commands-tasks.test.ts | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/auto-reply/reply/commands-tasks.test.ts b/src/auto-reply/reply/commands-tasks.test.ts index af6d0c710f6..c670897b56a 100644 --- a/src/auto-reply/reply/commands-tasks.test.ts +++ b/src/auto-reply/reply/commands-tasks.test.ts @@ -7,6 +7,7 @@ import { failTaskRunByRunId, } from "../../tasks/task-executor.js"; import { resetTaskRegistryForTests } from "../../tasks/task-registry.js"; +import { configureTaskRegistryRuntime } from "../../tasks/task-registry.store.js"; import { buildTasksReply, handleTasksCommand } from "./commands-tasks.js"; import { buildCommandTestParams } from "./commands.test-harness.js"; @@ -24,13 +25,33 @@ async function buildTasksReplyForTest(params: { sessionKey?: string } = {}) { }); } +function configureInMemoryTaskRegistryStoreForTests(): void { + configureTaskRegistryRuntime({ + store: { + loadSnapshot: () => ({ + tasks: new Map(), + deliveryStates: new Map(), + }), + saveSnapshot: () => {}, + upsertTaskWithDeliveryState: () => {}, + upsertTask: () => {}, + deleteTaskWithDeliveryState: () => {}, + deleteTask: () => {}, + upsertDeliveryState: () => {}, + deleteDeliveryState: () => {}, + close: () => {}, + }, + }); +} + describe("buildTasksReply", () => { beforeEach(() => { - resetTaskRegistryForTests(); + resetTaskRegistryForTests({ persist: false }); + configureInMemoryTaskRegistryStoreForTests(); }); afterEach(() => { - resetTaskRegistryForTests(); + resetTaskRegistryForTests({ persist: false }); }); it("lists active and recent tasks for the current session", async () => {