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") api: {
return { users: { ensureUser: "users:ensureUser" },
...actual, devices: {
api: { heartbeat: "devices:heartbeat",
...actual.api, upsertInventory: "devices:upsertInventory",
users: { ensureUser: "users:ensureUser" }, findByAuthEmail: "devices:findByAuthEmail",
remove: "devices:remove",
}, },
} },
}) }))
describe("POST /api/admin/devices/rename", () => { describe("POST /api/admin/devices/rename", () => {
beforeEach(() => { beforeEach(() => {