import { describe, it, expect, vi, beforeEach } from "vitest"; const invoke = vi.fn(); vi.mock("@tauri-apps/api/core", () => ({ invoke: (...args: unknown[]) => invoke(...args), })); import { TauriProjectGateway } from "./project"; describe("TauriProjectGateway invoke payloads", () => { beforeEach(() => invoke.mockReset().mockResolvedValue({})); it("reads and updates the project context under .ideai", async () => { invoke.mockResolvedValueOnce("# shared"); await expect(new TauriProjectGateway().readProjectContext("proj-1")).resolves.toBe( "# shared", ); expect(invoke).toHaveBeenCalledWith("read_project_context", { projectId: "proj-1", }); await new TauriProjectGateway().updateProjectContext("proj-1", "# next"); expect(invoke).toHaveBeenCalledWith("update_project_context", { request: { projectId: "proj-1", content: "# next" }, }); }); });