Add DI-based AuthContext wrapper and migrate auth flows to improve testability
- Introduced a new `AuthContext` with Dependency Injection to replace direct `useAuthStore` access, enhancing E2E testability. - Migrated authentication core components (`AuthInitializer`, `AuthGuard`, `Header`) and hooks (`useAuth`, `useUser`) to use `AuthContext`. - Updated test suite: - Refactored unit tests to mock `AuthContext` instead of `useAuthStore`. - Enhanced E2E test helpers to inject mock auth stores for authenticated and admin scenarios. - Verified API client interceptors remain compatible with the new setup. - No breaking changes; maintained 98.38% test coverage.
This commit is contained in:
1979
AUTH_CONTEXT_MIGRATION_PLAN.md
Normal file
1979
AUTH_CONTEXT_MIGRATION_PLAN.md
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user