forked from cardosofelipe/fast-next-template
**Authentication Refactor:** Remove authStore and its associated tests, transitioning to the new authentication model. Add dynamic loading for PasswordResetConfirmForm to optimize performance. Include a theme initialization script in layout.tsx to prevent FOUC.
This commit is contained in:
@@ -29,7 +29,7 @@ let mockAuthState: {
|
||||
user: null,
|
||||
};
|
||||
|
||||
jest.mock('@/stores/authStore', () => ({
|
||||
jest.mock('@/lib/stores/authStore', () => ({
|
||||
useAuthStore: () => mockAuthState,
|
||||
}));
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
import { render, waitFor } from '@testing-library/react';
|
||||
import { AuthInitializer } from '@/components/auth/AuthInitializer';
|
||||
import { useAuthStore } from '@/stores/authStore';
|
||||
import { useAuthStore } from '@/lib/stores/authStore';
|
||||
|
||||
// Mock the auth store
|
||||
jest.mock('@/stores/authStore', () => ({
|
||||
jest.mock('@/lib/stores/authStore', () => ({
|
||||
useAuthStore: jest.fn(),
|
||||
}));
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ jest.mock('next/navigation', () => ({
|
||||
}));
|
||||
|
||||
// Mock auth store
|
||||
jest.mock('@/stores/authStore', () => ({
|
||||
jest.mock('@/lib/stores/authStore', () => ({
|
||||
useAuthStore: () => ({
|
||||
isAuthenticated: false,
|
||||
setAuth: jest.fn(),
|
||||
|
||||
@@ -38,7 +38,7 @@ jest.mock('next/navigation', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('@/stores/authStore', () => ({
|
||||
jest.mock('@/lib/stores/authStore', () => ({
|
||||
useAuthStore: () => ({
|
||||
isAuthenticated: false,
|
||||
setAuth: jest.fn(),
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { Header } from '@/components/layout/Header';
|
||||
import { useAuthStore } from '@/stores/authStore';
|
||||
import { useAuthStore } from '@/lib/stores/authStore';
|
||||
import { useLogout } from '@/lib/api/hooks/useAuth';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import type { User } from '@/stores/authStore';
|
||||
import type { User } from '@/lib/stores/authStore';
|
||||
|
||||
// Mock dependencies
|
||||
jest.mock('@/stores/authStore', () => ({
|
||||
jest.mock('@/lib/stores/authStore', () => ({
|
||||
useAuthStore: jest.fn(),
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user