mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 15:35:03 +00:00
test(core): reduce reset overhead in messaging and agent e2e mocks
This commit is contained in:
@@ -18,7 +18,7 @@ describe("requestExecApprovalDecision", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.mocked(callGatewayTool).mockReset();
|
vi.mocked(callGatewayTool).mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns string decisions", async () => {
|
it("returns string decisions", async () => {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function mockSingleActiveSummary(overrides: Partial<typeof baseActiveAnthropicSu
|
|||||||
|
|
||||||
describe("bedrock discovery", () => {
|
describe("bedrock discovery", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
sendMock.mockReset();
|
sendMock.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("filters to active streaming text models and maps modalities", async () => {
|
it("filters to active streaming text models and maps modalities", async () => {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ function createManagedRun(exit: MockRunExit, pid = 1234) {
|
|||||||
|
|
||||||
describe("runCliAgent with process supervisor", () => {
|
describe("runCliAgent with process supervisor", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
supervisorSpawnMock.mockReset();
|
supervisorSpawnMock.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("runs CLI through supervisor and returns payload", async () => {
|
it("runs CLI through supervisor and returns payload", async () => {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ vi.mock("../../gateway/call.js", () => ({
|
|||||||
|
|
||||||
describe("gateway tool defaults", () => {
|
describe("gateway tool defaults", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
callGatewayMock.mockReset();
|
callGatewayMock.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("leaves url undefined so callGateway can use config", () => {
|
it("leaves url undefined so callGateway can use config", () => {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ beforeEach(async () => {
|
|||||||
process.env.DISCORD_BOT_TOKEN = "";
|
process.env.DISCORD_BOT_TOKEN = "";
|
||||||
testConfig = {};
|
testConfig = {};
|
||||||
await setRegistry(createTestRegistry([]));
|
await setRegistry(createTestRegistry([]));
|
||||||
callGatewayMock.mockReset();
|
callGatewayMock.mockClear();
|
||||||
webAuthExists.mockClear().mockResolvedValue(false);
|
webAuthExists.mockClear().mockResolvedValue(false);
|
||||||
handleDiscordAction.mockClear();
|
handleDiscordAction.mockClear();
|
||||||
handleSlackAction.mockClear();
|
handleSlackAction.mockClear();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ describe("resolveDiscordTarget", () => {
|
|||||||
const listPeers = vi.mocked(listDiscordDirectoryPeersLive);
|
const listPeers = vi.mocked(listDiscordDirectoryPeersLive);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
listPeers.mockReset();
|
listPeers.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns a resolved user for usernames", async () => {
|
it("returns a resolved user for usernames", async () => {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ vi.mock("../../gateway/call.js", () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
callGatewayMock.mockReset();
|
callGatewayMock.mockClear();
|
||||||
setRegistry(emptyRegistry);
|
setRegistry(emptyRegistry);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user