import { describe, expect, it, vi } from "vitest"; import { SystemRole } from "@capakraken/shared"; vi.mock("@capakraken/application", async (importOriginal) => { const actual = await importOriginal(); return { ...actual, getDashboardBudgetForecast: vi.fn().mockResolvedValue([]), getDashboardPeakTimes: vi.fn().mockResolvedValue([]), listAssignmentBookings: vi.fn().mockResolvedValue([]), }; }); import { executeTool } from "../router/assistant-tools.js"; import { createToolContext, withUserLookup } from "./assistant-tools-notification-test-helpers.js"; describe("assistant reminder mutation tools - errors", () => { it("returns a stable assistant error when updating a missing reminder", async () => { const ctx = createToolContext(withUserLookup({ notification: { findFirst: vi.fn().mockResolvedValue(null), }, }), SystemRole.ADMIN); const result = await executeTool( "update_reminder", JSON.stringify({ id: "rem_missing", title: "Updated" }), ctx, ); expect(JSON.parse(result.content)).toEqual({ error: "Reminder not found with the given criteria.", }); }); it("returns a stable assistant error when deleting a missing reminder", async () => { const ctx = createToolContext(withUserLookup({ notification: { findFirst: vi.fn().mockResolvedValue(null), }, }), SystemRole.ADMIN); const result = await executeTool( "delete_reminder", JSON.stringify({ id: "rem_missing" }), ctx, ); expect(JSON.parse(result.content)).toEqual({ error: "Reminder not found with the given criteria.", }); }); });