import { beforeEach, describe, expect, it, vi } from 'vitest' vi.mock('../../lib/prisma', () => ({ prisma: { employee: { findFirst: vi.fn(), }, }, })) import { prisma } from '../../lib/prisma' import { findActiveEmployeeByEmail, findEmployeeWithCompanyByEmail } from './auth.employee.repo' describe('auth.employee.repo', () => { beforeEach(() => { vi.clearAllMocks() }) it('looks up employee login email case-insensitively', async () => { await findEmployeeWithCompanyByEmail('Owner@Example.com') expect(prisma.employee.findFirst).toHaveBeenCalledWith({ where: { email: { equals: 'Owner@Example.com', mode: 'insensitive', }, }, include: { company: true }, }) }) it('looks up active employee reset email case-insensitively', async () => { await findActiveEmployeeByEmail('Owner@Example.com') expect(prisma.employee.findFirst).toHaveBeenCalledWith({ where: { email: { equals: 'Owner@Example.com', mode: 'insensitive', }, isActive: true, }, }) }) })