mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 11:58:38 +00:00
test(agents): use lightweight clears in supervisor and session-status setup
This commit is contained in:
@@ -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(() => {
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user