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 })),
}))
vi.mock("@/convex/_generated/api", async () => {
const actual = await import("@/convex/_generated/api")
return {
...actual,
vi.mock("@/convex/_generated/api", () => ({
api: {
...actual.api,
users: { ensureUser: "users:ensureUser" },
devices: {
heartbeat: "devices:heartbeat",
upsertInventory: "devices:upsertInventory",
findByAuthEmail: "devices:findByAuthEmail",
remove: "devices:remove",
},
}
})
},
}))
describe("POST /api/admin/devices/rename", () => {
beforeEach(() => {