Use vitest
This commit is contained in:
parent
b46de85926
commit
cca5e31f56
15 changed files with 825 additions and 96 deletions
|
|
@ -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 }))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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' })
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue