mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:58:28 +00:00
test(core): reduce mock reset overhead across unit and e2e specs
This commit is contained in:
@@ -39,7 +39,7 @@ function mockNodeList(commands?: string[]) {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
callGateway.mockReset();
|
||||
callGateway.mockClear();
|
||||
});
|
||||
|
||||
describe("nodes camera_snap", () => {
|
||||
|
||||
@@ -26,7 +26,7 @@ function createSandbox(overrides?: Partial<SandboxContext>): SandboxContext {
|
||||
|
||||
describe("sandbox fs bridge shell compatibility", () => {
|
||||
beforeEach(() => {
|
||||
mockedExecDockerRaw.mockReset();
|
||||
mockedExecDockerRaw.mockClear();
|
||||
mockedExecDockerRaw.mockImplementation(async (args) => {
|
||||
const script = args[5] ?? "";
|
||||
if (script.includes('stat -c "%F|%s|%Y"')) {
|
||||
|
||||
@@ -32,7 +32,7 @@ describe("sessions_spawn requesterOrigin threading", () => {
|
||||
beforeEach(() => {
|
||||
const callGatewayMock = getCallGatewayMock();
|
||||
resetSubagentRegistryForTests();
|
||||
callGatewayMock.mockReset();
|
||||
callGatewayMock.mockClear();
|
||||
setSessionsSpawnConfigOverride({
|
||||
session: {
|
||||
mainKey: "main",
|
||||
|
||||
@@ -42,7 +42,7 @@ describe("emitSubagentEndedHookOnce", () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
lifecycleMocks.getGlobalHookRunner.mockReset();
|
||||
lifecycleMocks.getGlobalHookRunner.mockClear();
|
||||
lifecycleMocks.runSubagentEnded.mockClear();
|
||||
});
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ describe("announce loop guard (#18264)", () => {
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
loadSubagentRegistryFromDisk.mockReset();
|
||||
loadSubagentRegistryFromDisk.mockClear();
|
||||
loadSubagentRegistryFromDisk.mockReturnValue(new Map());
|
||||
saveSubagentRegistryToDisk.mockClear();
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -9,7 +9,7 @@ import { readLatestAssistantReply } from "./agent-step.js";
|
||||
|
||||
describe("readLatestAssistantReply", () => {
|
||||
beforeEach(() => {
|
||||
callGatewayMock.mockReset();
|
||||
callGatewayMock.mockClear();
|
||||
});
|
||||
|
||||
it("returns the most recent assistant message when compaction markers trail history", async () => {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { createCronTool } from "./cron-tool.js";
|
||||
|
||||
describe("cron tool flat-params", () => {
|
||||
beforeEach(() => {
|
||||
callGatewayToolMock.mockReset();
|
||||
callGatewayToolMock.mockClear();
|
||||
callGatewayToolMock.mockResolvedValue({ ok: true });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user