Use vitest

This commit is contained in:
tusooa 2025-02-27 22:54:23 -05:00
commit cca5e31f56
No known key found for this signature in database
GPG key ID: 42AEC43D48433C51
15 changed files with 825 additions and 96 deletions

View file

@ -1,10 +1,13 @@
import { deserialize } from 'src/services/theme_data/iss_deserializer.js'
import { serialize } from 'src/services/theme_data/iss_serializer.js'
const componentsContext = require.context('src', true, /\.style.js(on)?$/)
const componentsContext = import.meta.glob(
['/src/**/*.style.js', '/src/**/*.style.json'],
{ eager: true }
)
describe('ISS (de)serialization', () => {
componentsContext.keys().forEach(key => {
const component = componentsContext(key).default
Object.keys(componentsContext).forEach(key => {
const component = componentsContext[key].default
it(`(De)serialization of component ${component.name} works`, () => {
const normalized = component.defaultRules.map(x => ({ component: component.name, ...x }))

View file

@ -16,10 +16,10 @@ const checkColors = (output) => {
}
describe('Theme Data utility functions', () => {
const context = require.context('static/themes/', false, /\.json$/)
context.keys().forEach((key) => {
const context = import.meta.glob('/public/static/themes/*.json', { import: 'default', eager: true })
Object.keys(context).forEach((key) => {
it(`Should render all colors for ${key} properly`, () => {
const { theme, source } = context(key)
const { theme, source } = context[key]
const data = source || theme
const colors = getColors(data.colors, data.opacity, 1)
checkColors(colors)

View file

@ -62,8 +62,6 @@ describe('Theme Data 3', () => {
})
describe('init', function () {
this.timeout(5000)
it('Test initialization without anything', () => {
const out = init({ inputRuleset: [], ultimateBackgroundColor: '#DEADAF' })