import { describe, expect, it } from 'vitest'
import {
  TOKEN_COLORS,
  TOKEN_RADII,
  TOKEN_FONT_SIZES,
  TOKEN_WEIGHTS,
  colorVar,
} from './index'

describe('TOKEN_COLORS', () => {
  it('includes the semantic surface + intent tokens', () => {
    expect(TOKEN_COLORS).toContain('fg')
    expect(TOKEN_COLORS).toContain('surface-raised')
    expect(TOKEN_COLORS).toContain('danger')
  })
  it('has no duplicates', () => {
    expect(new Set(TOKEN_COLORS).size).toBe(TOKEN_COLORS.length)
  })
  it('pairs every intent with a foreground companion (text-on-fill contrast seam)', () => {
    for (const intent of ['success', 'warning', 'danger', 'info'] as const) {
      expect(TOKEN_COLORS).toContain(intent)
      expect(TOKEN_COLORS).toContain(`${intent}-fg`)
    }
  })
})

describe('TOKEN_RADII', () => {
  it('spans none → full with no duplicates', () => {
    expect(TOKEN_RADII).toContain('none')
    expect(TOKEN_RADII).toContain('full')
    expect(new Set(TOKEN_RADII).size).toBe(TOKEN_RADII.length)
  })
})

describe('TOKEN_FONT_SIZES', () => {
  it('includes base + the display sizes with no duplicates', () => {
    expect(TOKEN_FONT_SIZES).toContain('base')
    expect(TOKEN_FONT_SIZES).toContain('3xl')
    expect(new Set(TOKEN_FONT_SIZES).size).toBe(TOKEN_FONT_SIZES.length)
  })
})

describe('TOKEN_WEIGHTS', () => {
  it('runs normal → bold with no duplicates', () => {
    expect(TOKEN_WEIGHTS).toContain('normal')
    expect(TOKEN_WEIGHTS).toContain('bold')
    expect(new Set(TOKEN_WEIGHTS).size).toBe(TOKEN_WEIGHTS.length)
  })
})

describe('colorVar', () => {
  it('maps a token to its custom-property name', () => {
    expect(colorVar('fg')).toBe('--mod-color-fg')
    expect(colorVar('accent-fg')).toBe('--mod-color-accent-fg')
  })
})
