import { describe, it, expect } from 'vitest';
import { resolveTheme, THEME_PRESETS } from './themes.js';

describe('themes.ts', () => {
  it('exposes 6 presets', () => {
    expect(Object.keys(THEME_PRESETS).sort()).toEqual([
      'academic', 'corporate-blue', 'dark',
      'minimal-mono', 'vibrant', 'warm-paper',
    ]);
  });

  it('resolveTheme returns preset defaults when no overrides', () => {
    const t = resolveTheme('corporate-blue', {});
    expect(t.primary).toBe('#1A5490');
    expect(t.accent).toBe('#E87722');
    expect(t.background).toBe('#FFFFFF');
    expect(t.title_size).toBe(40);
    expect(t.heading_font).toBe('Yu Gothic UI');
  });

  it('resolveTheme overrides shallow-merge', () => {
    const t = resolveTheme('minimal-mono', { primary: '#FF0000', title_size: 48 });
    expect(t.primary).toBe('#FF0000');
    expect(t.title_size).toBe(48);
    expect(t.accent).toBe('#888888'); // unchanged
  });

  it('dark preset uses dark background', () => {
    const t = resolveTheme('dark', {});
    expect(t.background).toBe('#0F1419');
    expect(t.text).toBe('#F5F5F5');
  });
});
