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

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

import { transformIgnoreDefault } from './ignore-default.mjs'

describe('transform/IgnoreDefault', () => {
  it('should return the transformed token name without "default" path item', () => {
    const token = {
      path: ['color', 'default', 'primary'],
    } as TransformedToken
    const config = {
      prefix: 'theme',
    }
    const result = transformIgnoreDefault(token, config, {})
    expect(result).toEqual('theme-color-primary')
  })

  it('should return respect token prefix', () => {
    const token = {
      path: ['size', 'default', 'small'],
    } as TransformedToken
    const config = {
      prefix: 'theme',
    }
    const result = transformIgnoreDefault(token, config, {})
    expect(result).toEqual('theme-size-small')
  })

  it('should leave token name unchanged if no "default" is found', () => {
    const token = {
      path: ['color', 'primary'],
    } as TransformedToken
    const config = {
      prefix: 'theme',
    }
    const result = transformIgnoreDefault(token, config, {})
    expect(result).toEqual('theme-color-primary')
  })
})
