import { describe, it, expect } from 'vitest';
import { BUILTIN_THEMES } from '../builtin-themes';

describe('BUILTIN_THEMES', () => {
  it('contains exactly 3 themes', () => {
    expect(BUILTIN_THEMES).toHaveLength(3);
  });

  it('all themes have required fields', () => {
    for (const theme of BUILTIN_THEMES) {
      expect(theme.id).toBeTruthy();
      expect(theme.name).toBeTruthy();
      expect(theme.version).toBeTruthy();
      expect(theme.author).toBe('Built-in');
      expect(theme.css).toBeTruthy();
      expect(theme.variants).toEqual(['light', 'dark']);
      expect(theme.enabled).toBe(true);
      expect(theme.builtIn).toBe(true);
    }
  });

  it('all IDs are prefixed with builtin-', () => {
    for (const theme of BUILTIN_THEMES) {
      expect(theme.id).toMatch(/^builtin-/);
    }
  });

  it('all themes have both :root and .dark selectors', () => {
    for (const theme of BUILTIN_THEMES) {
      expect(theme.css).toContain(':root');
      expect(theme.css).toContain('.dark');
    }
  });

  it('all themes set --color-primary', () => {
    for (const theme of BUILTIN_THEMES) {
      expect(theme.css).toContain('--color-primary:');
    }
  });

  it('themes have correct names', () => {
    const names = BUILTIN_THEMES.map(t => t.name);
    expect(names).toContain('Nord');
    expect(names).toContain('Catppuccin');
    expect(names).toContain('Solarized');
  });

  it('theme IDs are unique', () => {
    const ids = BUILTIN_THEMES.map(t => t.id);
    expect(new Set(ids).size).toBe(ids.length);
  });
});
