summaryrefslogtreecommitdiff
path: root/src/components/theme-provider.test.tsx
diff options
context:
space:
mode:
authorBertrand Yuan <189593334+bertyuan@users.noreply.github.com>2026-03-26 00:19:31 +0800
committerGitHub <noreply@github.com>2026-03-26 00:19:31 +0800
commitf247a8c4a863ec430f4a705b5c493d652c8429bd (patch)
tree71d0985970984c105582f6e3c370b254f38e9bbe /src/components/theme-provider.test.tsx
parentf7a02fe0e112cf108fc5f22872f1efc077e99fe8 (diff)
parentcd3c4bc89c169616b38bdb7443bb4eb7571b020c (diff)
Merge pull request #12 from bertyuan/fix-vitestv1.1
Fix vitest
Diffstat (limited to 'src/components/theme-provider.test.tsx')
-rw-r--r--src/components/theme-provider.test.tsx23
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();
+ });
+});