test(api): cover assistant holiday calendar reads

This commit is contained in:
2026-03-31 23:57:53 +02:00
parent 5419c828fd
commit 616cb8510e
5 changed files with 335 additions and 0 deletions
@@ -0,0 +1,31 @@
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",
});
});
});