bulk operations test coverage
- tickets_missing_carnet: backend test coverage - ticket.test.ts: frontend adapter test coverage
This commit is contained in:
42
frontend/src/adapters/ticket.test.ts
Normal file
42
frontend/src/adapters/ticket.test.ts
Normal 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"],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user