import { describe, it, expect } from 'vitest';
import { divisiColors, chartColors, chartColorArray, tooltipStyle } from '@/lib/constants/theme';

describe('Theme tokens', () => {
  describe('divisiColors', () => {
    it('all color tokens are defined and non-empty strings', () => {
      for (const [key, value] of Object.entries(divisiColors)) {
        expect(value, `divisiColors.${key} should be a non-empty string`).toBeTruthy();
        expect(typeof value).toBe('string');
        expect(value.length).toBeGreaterThan(0);
      }
    });

    it('accent color is #c8e600', () => {
      expect(divisiColors.accent).toBe('#c8e600');
    });

    it('bg color is #1a1a2e', () => {
      expect(divisiColors.bg).toBe('#1a1a2e');
    });

    it('card color is #1e1e3a', () => {
      expect(divisiColors.card).toBe('#1e1e3a');
    });

    it('accentHover color is defined', () => {
      expect(divisiColors.accentHover).toBe('#d4f000');
    });

    it('textPrimary is white', () => {
      expect(divisiColors.textPrimary).toBe('#ffffff');
    });

    it('textSecondary is defined', () => {
      expect(divisiColors.textSecondary).toBe('#a0a0a0');
    });

    it('border is defined as rgba value', () => {
      expect(divisiColors.border).toContain('rgba');
    });
  });

  describe('chartColors', () => {
    it('all chart color tokens are defined and non-empty strings', () => {
      for (const [key, value] of Object.entries(chartColors)) {
        expect(value, `chartColors.${key} should be a non-empty string`).toBeTruthy();
        expect(typeof value).toBe('string');
        expect(value.length).toBeGreaterThan(0);
      }
    });

    it('primary chart color matches accent', () => {
      expect(chartColors.primary).toBe('#c8e600');
    });
  });

  describe('chartColorArray', () => {
    it('is a non-empty array', () => {
      expect(chartColorArray.length).toBeGreaterThan(0);
    });

    it('first element is the primary accent color', () => {
      expect(chartColorArray[0]).toBe('#c8e600');
    });

    it('all entries are non-empty strings', () => {
      for (const color of chartColorArray) {
        expect(typeof color).toBe('string');
        expect(color.length).toBeGreaterThan(0);
      }
    });
  });

  describe('tooltipStyle', () => {
    it('all tooltip tokens are defined and non-empty', () => {
      for (const [key, value] of Object.entries(tooltipStyle)) {
        expect(value, `tooltipStyle.${key} should be a non-empty string`).toBeTruthy();
        expect(typeof value).toBe('string');
        expect(value.length).toBeGreaterThan(0);
      }
    });
  });
});
