mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
test: share cron tool mock harness
This commit is contained in:
@@ -1,15 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const callGatewayMock = vi.fn();
|
||||
vi.mock("../../gateway/call.js", () => ({
|
||||
callGateway: (opts: unknown) => callGatewayMock(opts),
|
||||
}));
|
||||
|
||||
vi.mock("../agent-scope.js", () => ({
|
||||
resolveSessionAgentId: () => "agent-123",
|
||||
}));
|
||||
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { createCronTool } from "./cron-tool.js";
|
||||
import { callGatewayMock } from "./cron-tool.test-harness.js";
|
||||
|
||||
describe("cron tool", () => {
|
||||
async function executeAddAndReadDelivery(params: {
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const callGatewayMock = vi.fn();
|
||||
vi.mock("../../gateway/call.js", () => ({
|
||||
callGateway: (opts: unknown) => callGatewayMock(opts),
|
||||
}));
|
||||
|
||||
vi.mock("../agent-scope.js", () => ({
|
||||
resolveSessionAgentId: () => "agent-123",
|
||||
}));
|
||||
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { createCronTool } from "./cron-tool.js";
|
||||
import { callGatewayMock } from "./cron-tool.test-harness.js";
|
||||
|
||||
describe("cron tool flat-params", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
11
src/agents/tools/cron-tool.test-harness.ts
Normal file
11
src/agents/tools/cron-tool.test-harness.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
export const callGatewayMock = vi.fn();
|
||||
|
||||
vi.mock("../../gateway/call.js", () => ({
|
||||
callGateway: (opts: unknown) => callGatewayMock(opts),
|
||||
}));
|
||||
|
||||
vi.mock("../agent-scope.js", () => ({
|
||||
resolveSessionAgentId: () => "agent-123",
|
||||
}));
|
||||
Reference in New Issue
Block a user