From 740c88f195f3bacd26ac6f767b093e1bbdf99d7d Mon Sep 17 00:00:00 2001 From: Yogesh Chaudhary Date: Tue, 27 Jan 2026 16:39:29 +0530 Subject: [PATCH] test: fix flaky logout test race condition The test was only waiting for the logout function to exist before calling it, but not waiting for authentication to complete first. This caused intermittent failures when the test called logout() while isAuthenticated was still false. Fixed by waiting for both logout function AND authentication state in the same waitFor block, following the pattern used in other logout tests. --- __tests__/auth-provider.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/__tests__/auth-provider.test.tsx b/__tests__/auth-provider.test.tsx index 0c958f4e..38297635 100644 --- a/__tests__/auth-provider.test.tsx +++ b/__tests__/auth-provider.test.tsx @@ -491,6 +491,7 @@ describe('Auth0Provider', () => { ); await waitFor(() => { expect(result.current.logout).toBeInstanceOf(Function); + expect(result.current.isAuthenticated).toBe(true); }); await act(() => { result.current.logout();