testing ADR - architectural decisions
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Has been cancelled

This commit is contained in:
2025-12-12 00:01:35 -08:00
parent d3d637ebfe
commit 8b06a66b17
34 changed files with 764 additions and 20 deletions

View File

@@ -59,22 +59,14 @@ describe('useAuth Hook and AuthProvider', () => {
console.error = originalError;
});
it('initializes with a "Determining..." state and isLoading as true', async () => {
// Use fake timers to control async operations and prevent useEffect from running immediately.
vi.useFakeTimers();
it('initializes with a "Determining..." state and isLoading as true', () => {
const { result } = renderHook(() => useAuth(), { wrapper });
// At this point, the component has rendered with its initial state,
// but the useEffect has been queued and not yet executed.
// Immediately after the initial render, before the useEffect has resolved,
// the state should be in its initial "Determining..." phase.
expect(result.current.authStatus).toBe('Determining...');
expect(result.current.isLoading).toBe(true);
expect(result.current.user).toBeNull();
// Allow promises to resolve and timers to run to avoid leaving the test in a pending state.
await act(async () => {
vi.runAllTimers();
});
});
describe('Initial Auth Check (useEffect)', () => {