diff options
Diffstat (limited to 'src/components/theme-provider.test.tsx')
| -rw-r--r-- | src/components/theme-provider.test.tsx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/components/theme-provider.test.tsx b/src/components/theme-provider.test.tsx new file mode 100644 index 0000000..0ac54e1 --- /dev/null +++ b/src/components/theme-provider.test.tsx @@ -0,0 +1,23 @@ +import { render, screen } from '@testing-library/react'; +import type { ReactNode } from 'react'; +import { describe, expect, test, vi } from 'vitest'; +import { ThemeProvider } from './theme-provider'; + +vi.mock('next-themes', () => ({ + ThemeProvider: ({ children }: { children: ReactNode }) => ( + <div data-testid='next-themes-provider'>{children}</div> + ), +})); + +describe('ThemeProvider', () => { + test('renders children through next-themes provider', () => { + render( + <ThemeProvider attribute='class'> + <span>content</span> + </ThemeProvider>, + ); + + expect(screen.getByTestId('next-themes-provider')).toBeInTheDocument(); + expect(screen.getByText('content')).toBeInTheDocument(); + }); +}); |
