test: share cron tool mock harness

This commit is contained in:
Peter Steinberger
2026-02-19 14:26:59 +00:00
parent eb9861b20a
commit efca61e3ac
3 changed files with 15 additions and 22 deletions

View File

@@ -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: {

View File

@@ -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(() => {

View 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",
}));