Simplify AuthProvider implementation and remove E2E test store injection via window

- Removed `window.__TEST_AUTH_STORE__` logic for E2E test store injection in `AuthProvider` and related comments.
- Updated `AuthInitializer` to clarify E2E test behavior with mocked API responses.
- Streamlined `AuthContext` handling by prioritizing explicit `store` prop or production singleton.
This commit is contained in:
Felipe Cardoso
2025-11-05 11:45:54 +01:00
parent f23fdb974a
commit 63650f563d
2 changed files with 8 additions and 33 deletions

View File

@@ -35,12 +35,8 @@ export function AuthInitializer() {
const loadAuthFromStorage = useAuth((state) => state.loadAuthFromStorage);
useEffect(() => {
// Skip loading from storage in E2E tests - test store is already injected
if (typeof window !== 'undefined' && (window as any).__E2E_TEST__) {
return;
}
// Load auth state from encrypted storage on mount
// E2E tests use the real flow with mocked API responses
loadAuthFromStorage();
}, [loadAuthFromStorage]);