-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.ts
More file actions
43 lines (38 loc) · 883 Bytes
/
setup.ts
File metadata and controls
43 lines (38 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import "@testing-library/jest-dom"
import { vi } from "vitest"
// ---- Mock external email service (Resend) ----
vi.mock("resend", () => ({
Resend: vi.fn(() => ({
emails: {
send: vi.fn().mockResolvedValue({ id: "test-email-id" }),
},
})),
}))
// ---- Mock Blitz useQuery to prevent undefined data ----
vi.mock("@blitzjs/rpc", async () => {
const actual = await vi.importActual<any>("@blitzjs/rpc")
return {
...actual,
useQuery: vi.fn(() => [
{
users: [],
projectId: 1,
},
{},
]),
}
})
// ---- Mock current user hook ----
vi.mock("src/users/hooks/useCurrentUser", () => ({
useCurrentUser: () => ({
id: 1,
role: "ADMIN",
email: "test@test.com",
}),
}))
vi.mock("next/link", () => {
return {
__esModule: true,
default: ({ children }: { children: React.ReactNode }) => children,
}
})