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

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

import { transformTailwindThemePath } from './tailwind-theme-path.mjs'

describe('transform/tailwind-theme-path', () => {
  it('should transform the token path correctly if "default" is the last item', () => {
    const token = {
      path: ['color', 'primary', 'default'],
    } as TransformedToken
    const result = transformTailwindThemePath(token, {}, {}) as any
    expect(result.tailwindPath).toEqual(['color', 'primary', 'DEFAULT'])
  })

  it('should transform the token path correctly when "default" is not the last item', () => {
    const token = {
      path: ['color', 'default', 'primary'],
    } as TransformedToken
    const result = transformTailwindThemePath(token, {}, {}) as any
    expect(result.tailwindPath).toEqual(['color', 'primary'])
  })

  it('should transform the token path correctly when "default" is not found', () => {
    const token = {
      path: ['color', 'primary'],
    } as TransformedToken
    const result = transformTailwindThemePath(token, {}, {}) as any
    expect(result.tailwindPath).toEqual(['color', 'primary'])
  })
})
