bulk operations test coverage

- tickets_missing_carnet: backend test coverage
- ticket.test.ts: frontend adapter test coverage
This commit is contained in:
2026-07-28 20:41:46 +02:00
parent bd4f76ae74
commit 6fa41013ed
2 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,42 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
const invoke = vi.fn();
vi.mock("@tauri-apps/api/core", () => ({
invoke: (...args: unknown[]) => invoke(...args),
Channel: class {
onmessage: ((chunk: unknown) => void) | null = null;
},
}));
import { TauriTicketGateway } from "./ticket";
describe("TauriTicketGateway invoke payloads", () => {
beforeEach(() => invoke.mockReset().mockResolvedValue({ items: [] }));
it("bulk status wraps refs and status in the request DTO", async () => {
await new TauriTicketGateway().bulkUpdateStatus(
"proj-1",
["#1", "#2"],
"inProgress",
);
expect(invoke).toHaveBeenCalledWith("ticket_bulk_update_status", {
request: {
projectId: "proj-1",
refs: ["#1", "#2"],
status: "inProgress",
},
});
});
it("bulk delete wraps refs in the request DTO", async () => {
await new TauriTicketGateway().bulkDelete("proj-1", ["#3", "#4"]);
expect(invoke).toHaveBeenCalledWith("ticket_bulk_delete", {
request: {
projectId: "proj-1",
refs: ["#3", "#4"],
},
});
});
});