import { describe, it, expect } from 'vitest';
import { getLeagueCoverClasses } from './leagueCovers';

describe('getLeagueCoverClasses', () => {
  it('should return a string', () => {
    const result = getLeagueCoverClasses('test-league-id');
    expect(typeof result).toBe('string');
  });

  it('should include base layout classes', () => {
    const result = getLeagueCoverClasses('test-league-id');
    expect(result).toContain('w-full h-32 rounded-lg overflow-hidden border');
    expect(result).toContain('border-charcoal-outline/60');
  });

  it('should include a gradient class', () => {
    const result = getLeagueCoverClasses('test-league-id');
    expect(result).toContain('bg-gradient-to-r');
  });

  it('should produce consistent results for the same input', () => {
    const leagueId = 'test-league-id';
    const result1 = getLeagueCoverClasses(leagueId);
    const result2 = getLeagueCoverClasses(leagueId);
    expect(result1).toBe(result2);
  });

  it('should produce different results for different inputs', () => {
    const result1 = getLeagueCoverClasses('league-1');
    const result2 = getLeagueCoverClasses('league-2');
    expect(result1).not.toBe(result2);
  });

  it('should handle empty string input', () => {
    const result = getLeagueCoverClasses('');
    expect(typeof result).toBe('string');
    expect(result).toContain('bg-gradient-to-r');
  });

  it('should handle special characters in league ID', () => {
    const result = getLeagueCoverClasses('league-with-special-chars-123');
    expect(typeof result).toBe('string');
    expect(result).toContain('bg-gradient-to-r');
  });

  it('should cycle through available gradients', () => {
    // Test multiple different IDs to ensure we're using the gradient array
    const results = new Set<string>();
    for (let i = 0; i < 10; i++) {
      const result = getLeagueCoverClasses(`league-${i}`);
      results.add(result);
    }
    // Should have at least 2 different results (likely more)
    expect(results.size).toBeGreaterThan(1);
  });
});