test: share cron tool mock harness
This commit is contained in:
parent
eb9861b20a
commit
efca61e3ac
@ -1,15 +1,6 @@
|
|||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it } 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 { createCronTool } from "./cron-tool.js";
|
import { createCronTool } from "./cron-tool.js";
|
||||||
|
import { callGatewayMock } from "./cron-tool.test-harness.js";
|
||||||
|
|
||||||
describe("cron tool", () => {
|
describe("cron tool", () => {
|
||||||
async function executeAddAndReadDelivery(params: {
|
async function executeAddAndReadDelivery(params: {
|
||||||
|
|||||||
@ -1,15 +1,6 @@
|
|||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it } 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 { createCronTool } from "./cron-tool.js";
|
import { createCronTool } from "./cron-tool.js";
|
||||||
|
import { callGatewayMock } from "./cron-tool.test-harness.js";
|
||||||
|
|
||||||
describe("cron tool flat-params", () => {
|
describe("cron tool flat-params", () => {
|
||||||
beforeEach(() => {
|
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",
|
||||||
|
}));
|
||||||
Loading…
x
Reference in New Issue
Block a user