import { renderHook } from '@testing-library/react';
import { ThemeProvider, useTheme } from './theme-context';
describe('theme-context', () => {
beforeEach(() => {
localStorage.clear();
});
it('应该提供默认主题', () => {
const wrapper = ({ children }: { children: React.ReactNode }) => (
{children}
);
const { result } = renderHook(() => useTheme(), { wrapper });
expect(result.current.theme).toBe('light');
});
it('应该提供resolvedTheme', () => {
const wrapper = ({ children }: { children: React.ReactNode }) => (
{children}
);
const { result } = renderHook(() => useTheme(), { wrapper });
expect(result.current.resolvedTheme).toBe('light');
});
});