json-theme-even-fork/test/index.test.js

44 lines
980 B
JavaScript
Raw Normal View History

import { HtmlValidate } from 'html-validate'
2023-01-31 02:37:41 +01:00
import { expect, it } from 'vitest'
2023-09-04 02:29:45 +02:00
import sampleResume from 'resume-schema/sample.resume.json' assert { type: 'json' }
import { render } from '../index.js'
2023-09-04 02:29:45 +02:00
const resume = {
...sampleResume,
meta: {
...sampleResume.meta,
themeOptions: {
colors: {
background: ['lightgray', 'darkgray'],
},
2023-09-04 02:29:45 +02:00
},
},
basics: {
...sampleResume.basics,
image: 'image.jpg',
},
}
2023-01-31 02:37:41 +01:00
it('renders a resume', () => {
expect(render(resume)).toMatchSnapshot()
})
2023-07-22 02:35:49 +02:00
it('renders valid HTML', async () => {
const htmlvalidate = new HtmlValidate({
extends: ['html-validate:recommended', 'html-validate:prettier'],
rules: {
'doctype-style': 'off',
2023-09-04 02:29:45 +02:00
'no-inline-style': 'off',
'no-trailing-whitespace': 'off',
'tel-non-breaking': 'off',
},
})
const {
results: [{ messages } = {}],
2023-07-22 02:35:49 +02:00
} = await htmlvalidate.validateString(render(resume))
2023-01-31 02:37:41 +01:00
expect(messages).toBeUndefined()
})