30 lines
907 B
TypeScript
30 lines
907 B
TypeScript
import { name, version, license, url, author } from '../../package.json'
|
|
import { expect, test } from 'bun:test'
|
|
import data from '../../dist/palette.toml'
|
|
import colors from '../../src/palette'
|
|
import { toSnakeCase } from '../../src/helpers/string'
|
|
|
|
test('has header info', () => {
|
|
expect(data.name).toBe(name)
|
|
expect(data.version).toBe(version)
|
|
expect(data.license).toBe(license)
|
|
expect(data.sourcecode).toBe(url)
|
|
|
|
expect(data.author.name).toBe(author.name)
|
|
expect(data.author.email).toBe(author.email)
|
|
expect(data.author.url).toBe(author.url)
|
|
})
|
|
|
|
test('has expected colors', () => {
|
|
colors.forEach(color => {
|
|
const { name, l, c, h } = color
|
|
const dataColor = data.colors[toSnakeCase(name)]
|
|
|
|
expect(dataColor.name).toBe(name)
|
|
expect(dataColor.l).toBe(l)
|
|
expect(dataColor.c).toBe(c)
|
|
expect(dataColor.h).toBe(h)
|
|
expect(dataColor.hex).toBe(color.toHex())
|
|
})
|
|
})
|
|
|