import { describe, it, expect } from 'vitest';
import { envColorVar, isEnvColor, ENV_COLORS, DEFAULT_ENV_COLOR } from './env-colors';

describe('env-colors', () => {
  it('maps known colors to their css variables', () => {
    for (const c of ENV_COLORS) {
      expect(envColorVar(c)).toBe(`var(--env-color-${c})`);
    }
  });

  it('falls back to slate for unknown values', () => {
    expect(envColorVar('neon')).toBe('var(--env-color-slate)');
    expect(envColorVar(undefined)).toBe('var(--env-color-slate)');
    expect(envColorVar(null)).toBe('var(--env-color-slate)');
    expect(envColorVar('')).toBe('var(--env-color-slate)');
  });

  it('isEnvColor narrows types', () => {
    expect(isEnvColor('amber')).toBe(true);
    expect(isEnvColor('neon')).toBe(false);
    expect(isEnvColor(undefined)).toBe(false);
  });

  it('default is slate', () => {
    expect(DEFAULT_ENV_COLOR).toBe('slate');
  });
});
