import { describe, it, expect } from 'vitest'
import { withOpacity } from '../../shared/utils/color'

describe('withOpacity', () => {
  it('should convert 6-digit hex with opacity', () => {
    expect(withOpacity('#FF6B35', 0.5)).toBe('rgba(255,107,53,0.5)')
  })

  it('should convert 3-digit hex with opacity', () => {
    expect(withOpacity('#FFF', 1)).toBe('rgba(255,255,255,1)')
  })

  it('should handle hex without # prefix', () => {
    expect(withOpacity('000000', 0)).toBe('rgba(0,0,0,0)')
  })

  it('should handle 3-digit hex without # prefix', () => {
    expect(withOpacity('F00', 0.8)).toBe('rgba(255,0,0,0.8)')
  })

  it('should handle pure black', () => {
    expect(withOpacity('#000000', 1)).toBe('rgba(0,0,0,1)')
  })

  it('should handle pure white', () => {
    expect(withOpacity('#FFFFFF', 0.12)).toBe('rgba(255,255,255,0.12)')
  })

  it('should handle lowercase hex', () => {
    expect(withOpacity('#ff6b35', 0.5)).toBe('rgba(255,107,53,0.5)')
  })
})
