test(agents): use lightweight clears in supervisor and session-status setup

This commit is contained in:
Peter Steinberger
2026-02-22 07:37:53 +00:00
parent ba2790222d
commit b56c07e991
2 changed files with 10 additions and 10 deletions

View File

@@ -41,12 +41,12 @@ function createBackgroundSession(id: string, pid?: number) {
describe("process tool supervisor cancellation", () => { describe("process tool supervisor cancellation", () => {
beforeEach(() => { beforeEach(() => {
supervisorMock.spawn.mockReset(); supervisorMock.spawn.mockClear();
supervisorMock.cancel.mockReset(); supervisorMock.cancel.mockClear();
supervisorMock.cancelScope.mockReset(); supervisorMock.cancelScope.mockClear();
supervisorMock.reconcileOrphans.mockReset(); supervisorMock.reconcileOrphans.mockClear();
supervisorMock.getRecord.mockReset(); supervisorMock.getRecord.mockClear();
killProcessTreeMock.mockReset(); killProcessTreeMock.mockClear();
}); });
afterEach(() => { afterEach(() => {

View File

@@ -80,8 +80,8 @@ import "./test-helpers/fast-core-tools.js";
import { createOpenClawTools } from "./openclaw-tools.js"; import { createOpenClawTools } from "./openclaw-tools.js";
function resetSessionStore(store: Record<string, unknown>) { function resetSessionStore(store: Record<string, unknown>) {
loadSessionStoreMock.mockReset(); loadSessionStoreMock.mockClear();
updateSessionStoreMock.mockReset(); updateSessionStoreMock.mockClear();
loadSessionStoreMock.mockReturnValue(store); loadSessionStoreMock.mockReturnValue(store);
} }
@@ -177,8 +177,8 @@ describe("session_status tool", () => {
}); });
it("scopes bare session keys to the requester agent", async () => { it("scopes bare session keys to the requester agent", async () => {
loadSessionStoreMock.mockReset(); loadSessionStoreMock.mockClear();
updateSessionStoreMock.mockReset(); updateSessionStoreMock.mockClear();
const stores = new Map<string, Record<string, unknown>>([ const stores = new Map<string, Record<string, unknown>>([
[ [
"/tmp/main/sessions.json", "/tmp/main/sessions.json",