32 lines
832 B
TypeScript
32 lines
832 B
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
import {
|
|
createToolContext,
|
|
executeTool,
|
|
} from "./assistant-tools-holiday-read-test-helpers.js";
|
|
|
|
describe("assistant holiday calendar get tools", () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it("returns a stable error when a holiday calendar cannot be found by identifier", async () => {
|
|
const ctx = createToolContext({
|
|
holidayCalendar: {
|
|
findUnique: vi.fn().mockResolvedValue(null),
|
|
findFirst: vi.fn().mockResolvedValue(null),
|
|
},
|
|
});
|
|
|
|
const result = await executeTool(
|
|
"get_holiday_calendar",
|
|
JSON.stringify({ identifier: "Missing Calendar" }),
|
|
ctx,
|
|
);
|
|
|
|
expect(JSON.parse(result.content)).toEqual({
|
|
error: "Holiday calendar not found: Missing Calendar",
|
|
});
|
|
});
|
|
});
|