- Add TOTP-based MFA with setup, verify, disable, backup codes, and challenge flow - Add PII field encryption middleware with AES-256-GCM and deterministic search hashes - Add agents, inquiries, and leads domain modules with entities, events, value objects - Add web dashboard pages for inquiries and leads with detail dialogs - Add 30+ component tests (valuation, charts, listings, search, providers, UI) - Add Prisma migrations for encryption hash columns and MFA TOTP support - Fix all ESLint errors (unused imports, duplicate imports, lint auto-fixes) - Update dependencies and lock file - Clean up obsolete exploration/QA docs, add audit documentation Co-Authored-By: Paperclip <noreply@paperclip.ing>
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
import { AuthProvider } from '../auth-provider';
|
|
|
|
const mockInitialize = vi.fn();
|
|
|
|
vi.mock('@/lib/auth-store', () => ({
|
|
useAuthStore: (selector: (state: { initialize: () => void }) => unknown) =>
|
|
selector({ initialize: mockInitialize }),
|
|
}));
|
|
|
|
describe('AuthProvider', () => {
|
|
beforeEach(() => {
|
|
mockInitialize.mockClear();
|
|
});
|
|
|
|
it('renders children', () => {
|
|
render(
|
|
<AuthProvider>
|
|
<div>Child content</div>
|
|
</AuthProvider>,
|
|
);
|
|
expect(screen.getByText('Child content')).toBeInTheDocument();
|
|
});
|
|
|
|
it('calls initialize on mount', () => {
|
|
render(
|
|
<AuthProvider>
|
|
<div>Test</div>
|
|
</AuthProvider>,
|
|
);
|
|
expect(mockInitialize).toHaveBeenCalled();
|
|
});
|
|
|
|
it('renders multiple children', () => {
|
|
render(
|
|
<AuthProvider>
|
|
<div>Child 1</div>
|
|
<div>Child 2</div>
|
|
</AuthProvider>,
|
|
);
|
|
expect(screen.getByText('Child 1')).toBeInTheDocument();
|
|
expect(screen.getByText('Child 2')).toBeInTheDocument();
|
|
});
|
|
});
|