refactor: dedupe channel outbound and monitor tests

This commit is contained in:
Peter Steinberger
2026-03-03 00:14:52 +00:00
parent 6a42d09129
commit d7dda4dd1a
18 changed files with 301 additions and 450 deletions

View File

@@ -210,8 +210,10 @@ function createBoundThreadBindingManager(params: {
targetSessionKey: string;
agentId: string;
}): ThreadBindingManager {
const baseManager = createNoopThreadBindingManager(params.accountId);
const now = Date.now();
return {
accountId: params.accountId,
...baseManager,
getIdleTimeoutMs: () => 24 * 60 * 60 * 1000,
getMaxAgeMs: () => 0,
getByThreadId: (threadId: string) =>
@@ -224,20 +226,12 @@ function createBoundThreadBindingManager(params: {
targetSessionKey: params.targetSessionKey,
agentId: params.agentId,
boundBy: "system",
boundAt: Date.now(),
lastActivityAt: Date.now(),
boundAt: now,
lastActivityAt: now,
idleTimeoutMs: 24 * 60 * 60 * 1000,
maxAgeMs: 0,
}
: undefined,
getBySessionKey: () => undefined,
listBySessionKey: () => [],
listBindings: () => [],
touchThread: () => null,
bindTarget: async () => null,
unbindThread: () => null,
unbindBySessionKey: () => [],
stop: () => {},
: baseManager.getByThreadId(threadId),
};
}