mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 10:30:37 +09:00
27 lines
636 B
TypeScript
27 lines
636 B
TypeScript
|
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||
|
|
|
||
|
|
const mockApi = vi.hoisted(() => ({
|
||
|
|
get: vi.fn(),
|
||
|
|
}));
|
||
|
|
|
||
|
|
vi.mock("./client", () => ({
|
||
|
|
api: mockApi,
|
||
|
|
}));
|
||
|
|
|
||
|
|
import { issuesApi } from "./issues";
|
||
|
|
|
||
|
|
describe("issuesApi.list", () => {
|
||
|
|
beforeEach(() => {
|
||
|
|
mockApi.get.mockReset();
|
||
|
|
mockApi.get.mockResolvedValue([]);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("passes parentId through to the company issues endpoint", async () => {
|
||
|
|
await issuesApi.list("company-1", { parentId: "issue-parent-1", limit: 25 });
|
||
|
|
|
||
|
|
expect(mockApi.get).toHaveBeenCalledWith(
|
||
|
|
"/companies/company-1/issues?parentId=issue-parent-1&limit=25",
|
||
|
|
);
|
||
|
|
});
|
||
|
|
});
|