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 }) => (
      <ThemeProvider>{children}</ThemeProvider>
    );

    const { result } = renderHook(() => useTheme(), { wrapper });

    expect(result.current.theme).toBe('light');
  });

  it('应该提供resolvedTheme', () => {
    const wrapper = ({ children }: { children: React.ReactNode }) => (
      <ThemeProvider>{children}</ThemeProvider>
    );

    const { result } = renderHook(() => useTheme(), { wrapper });

    expect(result.current.resolvedTheme).toBe('light');
  });
});
