b93f5d5bdf
Adds test harness for the suite: - vitest.config.ts: happy-dom env, @/* alias, v8 coverage with 70% thresholds - setup.ts: env vars, global next/headers and next/navigation mocks - tsconfig.json: IDE alias resolution for test/ - __mocks__/prisma.ts: centralised Prisma mock auto-registered via vi.mock - fixtures/users.ts, fixtures/orders.ts: typed test data
28 lines
625 B
TypeScript
28 lines
625 B
TypeScript
export const mockUser = {
|
|
id: 'user-1',
|
|
email: 'test@example.com',
|
|
name: 'Test User',
|
|
passwordHash: '$2a$12$hashedpassword',
|
|
role: 'CUSTOMER' as const,
|
|
mustChangePassword: false,
|
|
createdAt: new Date('2024-01-01'),
|
|
updatedAt: new Date('2024-01-01'),
|
|
}
|
|
|
|
export const mockAdmin = {
|
|
...mockUser,
|
|
id: 'admin-1',
|
|
email: 'admin@example.com',
|
|
name: 'Admin User',
|
|
role: 'ADMIN' as const,
|
|
}
|
|
|
|
export const mockSession = {
|
|
id: 'session-1',
|
|
userId: mockUser.id,
|
|
tokenHash: 'abc123hash',
|
|
expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
|
|
createdAt: new Date('2024-01-01'),
|
|
user: mockUser,
|
|
}
|