import { describe, expect, it } from 'vitest';
import { schemeColors } from './scheme-colors';

describe('schemeColors', () => {
  it('returns the full fixed palette for a categorical scheme (count ignored)', () => {
    const colors = schemeColors('tableau10', 3);
    expect(colors).toHaveLength(10);
    expect(colors.every((c) => /^#[0-9a-f]{6}$/i.test(c))).toBe(true);
  });

  it('samples a continuous scheme at count stops, normalized to hex', () => {
    const colors = schemeColors('viridis', 5);
    expect(colors).toHaveLength(5);
    expect(colors.every((c) => /^#[0-9a-f]{6}$/.test(c))).toBe(true);
  });

  it('samples the midpoint for a single continuous stop', () => {
    expect(schemeColors('viridis', 1)).toHaveLength(1);
  });

  it('returns [] for an unknown scheme', () => {
    expect(schemeColors('not-a-scheme')).toEqual([]);
  });
});
