import { describe, it, expect, beforeEach, jest } from '@jest/globals';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { GlassCard } from './glass-card';

describe('GlassCard', () => {
  beforeEach(() => {
    jest.clearAllMocks();
  });

  describe('Rendering', () => {
    it('should render glass card', () => {
      const { container } = render(<GlassCard>Test Content</GlassCard>);
      expect(container.firstChild).toBeInTheDocument();
    });

    it('should render children', () => {
      render(<GlassCard>Test Content</GlassCard>);
      expect(screen.getByText('Test Content')).toBeInTheDocument();
    });

    it('should apply custom className', () => {
      const { container } = render(<GlassCard className="custom-class">Test</GlassCard>);
      expect(container.firstChild).toHaveClass('custom-class');
    });
  });

  describe('Variants', () => {
    it('should render default variant', () => {
      const { container } = render(<GlassCard>Test</GlassCard>);
      expect(container.firstChild).toBeInTheDocument();
    });

    it('should render elevated variant', () => {
      const { container } = render(<GlassCard variant="elevated">Test</GlassCard>);
      expect(container.firstChild).toBeInTheDocument();
    });

    it('should render outline variant', () => {
      const { container } = render(<GlassCard variant="outline">Test</GlassCard>);
      expect(container.firstChild).toBeInTheDocument();
    });

    it('should render glow variant', () => {
      const { container } = render(<GlassCard variant="glow">Test</GlassCard>);
      expect(container.firstChild).toBeInTheDocument();
    });
  });

  describe('Styling', () => {
    it('should have rounded class', () => {
      const { container } = render(<GlassCard>Test</GlassCard>);
      expect(container.firstChild).toHaveClass('rounded-2xl');
    });

    it('should have border class', () => {
      const { container } = render(<GlassCard>Test</GlassCard>);
      expect(container.firstChild).toHaveClass('border');
    });

    it('should have backdrop-blur class', () => {
      const { container } = render(<GlassCard>Test</GlassCard>);
      expect(container.firstChild).toHaveClass('backdrop-blur-xl');
    });
  });

  describe('Forward Ref', () => {
    it('should forward ref', () => {
      const ref = { current: null };
      render(<GlassCard ref={ref}>Test</GlassCard>);
      expect(ref.current).toBeInstanceOf(HTMLDivElement);
    });
  });
});
