Avoid recursive import in api mock for bun tests

This commit is contained in:
Esdras Renan 2025-11-27 08:38:11 -03:00
parent 09711d0465
commit 2e735a7df4

View file

@ -13,16 +13,17 @@ vi.mock("convex/browser", () => ({
ConvexHttpClient: vi.fn(() => ({ mutation: mutationMock })), ConvexHttpClient: vi.fn(() => ({ mutation: mutationMock })),
})) }))
vi.mock("@/convex/_generated/api", async () => { vi.mock("@/convex/_generated/api", () => ({
const actual = await import("@/convex/_generated/api")
return {
...actual,
api: { api: {
...actual.api,
users: { ensureUser: "users:ensureUser" }, users: { ensureUser: "users:ensureUser" },
devices: {
heartbeat: "devices:heartbeat",
upsertInventory: "devices:upsertInventory",
findByAuthEmail: "devices:findByAuthEmail",
remove: "devices:remove",
}, },
} },
}) }))
describe("POST /api/admin/devices/rename", () => { describe("POST /api/admin/devices/rename", () => {
beforeEach(() => { beforeEach(() => {