import type { TransformedToken } from 'style-dictionary/types'

import { describe, expect, it } from 'vitest'

import { isColorToken, isDimension } from './basic.mjs'

describe('isColorToken', () => {
  it('should return true when type is "color"', () => {
    const token = {
      $type: 'color',
      type: 'color',
    } as TransformedToken
    expect(isColorToken(token, { usesDtcg: true })).toEqual(true)
    expect(isColorToken(token, { usesDtcg: false })).toEqual(true)
  })

  it('should return false when type is not "color"', () => {
    const token = {
      $type: 'dimension',
      type: 'dimension',
    } as TransformedToken
    expect(isColorToken(token, { usesDtcg: true })).toEqual(false)
    expect(isColorToken(token, { usesDtcg: false })).toEqual(false)
  })
})

describe('isDimension', () => {
  it('should return true when type is "dimension"', () => {
    const token = {
      $type: 'dimension',
      type: 'dimension',
    } as TransformedToken
    expect(isDimension(token, { usesDtcg: true })).toEqual(true)
    expect(isDimension(token, { usesDtcg: false })).toEqual(true)
  })

  it('should return false when type is not "dimension"', () => {
    const token = {
      $type: 'color',
      type: 'color',
    } as TransformedToken
    expect(isDimension(token, { usesDtcg: true })).toEqual(false)
    expect(isDimension(token, { usesDtcg: false })).toEqual(false)
  })
})
