import { renderHook } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import { useTheme } from './useTheme';
import { ThemeProvider } from '../contexts/ThemeContext';
import React from 'react';

describe('useTheme hook', () => {
  it('throws error when used outside of ThemeProvider', () => {
    const wrapper = ({ children }: { children: React.ReactNode }) => (
      <ThemeProvider defaultTheme="dark">{children}</ThemeProvider>
    );

    const { result } = renderHook(() => useTheme(), { wrapper });
    expect(result.current.theme).toBe('dark');
  });
});
