/** * Tests for Providers Component * Verifies React Query and Theme providers are configured correctly */ import { render, screen } from '@testing-library/react'; import { Providers } from '@/app/providers'; // Mock components jest.mock('@/components/theme', () => ({ ThemeProvider: ({ children }: { children: React.ReactNode }) => (
{children}
), })); // Mock TanStack Query jest.mock('@tanstack/react-query', () => ({ QueryClient: jest.fn().mockImplementation(() => ({})), QueryClientProvider: ({ children }: { children: React.ReactNode }) => (
{children}
), })); describe('Providers', () => { it('renders without crashing', () => { render(
Test Content
); expect(screen.getByText('Test Content')).toBeInTheDocument(); }); it('wraps children with ThemeProvider', () => { render(
Test Content
); expect(screen.getByTestId('theme-provider')).toBeInTheDocument(); }); it('wraps children with QueryClientProvider', () => { render(
Test Content
); expect(screen.getByTestId('query-provider')).toBeInTheDocument(); }); it('renders children', () => { render(
Child Component
); expect(screen.getByTestId('test-child')).toBeInTheDocument(); expect(screen.getByText('Child Component')).toBeInTheDocument(); }); });