Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Dec 9, 2024
1 parent 33a2d9a commit 0c9dd8b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/transformers/colorAlphaToCss.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {TransformedToken} from 'style-dictionary/types'

Check warning on line 1 in src/transformers/colorAlphaToCss.test.ts

View workflow job for this annotation

GitHub Actions / Test & Lint

All imports in the declaration are only used as types. Use `import type`
import {getMockToken} from '../test-utilities/index.js'
import {colorAlphaToCss} from './colorAlphaToCss.js'

Expand All @@ -9,7 +10,7 @@ describe('Transformer: colorAlphaToCss', () => {
getMockToken({$value: '#34343455'}),
]
const expectedOutput = ['#123', '#343434', '#34343455']
expect(input.map(item => colorAlphaToCss.transform(item, {}, {}))).toStrictEqual(expectedOutput)
expect(input.map(item => colorAlphaToCss.transform(item as TransformedToken, {}, {}))).toStrictEqual(expectedOutput)
})

it('transforms hex3, hex6, hex8 `color` tokens with alpha value', () => {
Expand All @@ -19,19 +20,19 @@ describe('Transformer: colorAlphaToCss', () => {
getMockToken({$value: '#34343466', alpha: 0.1}),
]
const expectedOutput = [
'color-mix(#123, transparent 25%)',
'color-mix(#343434, transparent 60%)',
'color-mix(#34343466, transparent 10%)',
'color-mix(in srgb, #123, transparent 25%)',
'color-mix(in srgb, #343434, transparent 60%)',
'color-mix(in srgb, #34343466, transparent 10%)',
]
expect(input.map(item => colorAlphaToCss.transform(item, {}, {}))).toStrictEqual(expectedOutput)
expect(input.map(item => colorAlphaToCss.transform(item as TransformedToken, {}, {}))).toStrictEqual(expectedOutput)
})

it('transforms references with and without alpha value', () => {
const input = [
getMockToken({$value: '{base.color.green.5}'}),
getMockToken({$value: '{base.color.red.5}', alpha: 0.25}),
]
const expectedOutput = ['{base.color.green.5}', 'color-mix({base.color.red.5}, transparent 25%)']
expect(input.map(item => colorAlphaToCss.transform(item, {}, {}))).toStrictEqual(expectedOutput)
const expectedOutput = ['{base.color.green.5}', 'color-mix(in srgb, {base.color.red.5}, transparent 25%)']
expect(input.map(item => colorAlphaToCss.transform(item as TransformedToken, {}, {}))).toStrictEqual(expectedOutput)
})
})

0 comments on commit 0c9dd8b

Please sign in to comment.