2021-11-05 18:39:36 +01:00
|
|
|
import { HtmlValidate } from 'html-validate'
|
2023-01-31 02:37:41 +01:00
|
|
|
import { expect, it } from 'vitest'
|
2020-07-05 13:30:25 +02:00
|
|
|
|
2021-11-05 18:39:36 +01:00
|
|
|
import { render } from '../index.js'
|
2022-03-08 13:51:47 +01:00
|
|
|
import resume from 'resume-schema/sample.resume.json' assert { type: 'json' }
|
2020-07-05 13:30:25 +02:00
|
|
|
|
2021-06-20 16:23:55 +02:00
|
|
|
// Overwrite empty sample resume values
|
|
|
|
resume.basics.image = 'image.jpg'
|
|
|
|
|
2023-01-31 02:37:41 +01:00
|
|
|
it('renders a resume', () => {
|
|
|
|
expect(render(resume)).toMatchSnapshot()
|
2020-07-05 13:30:25 +02:00
|
|
|
})
|
2020-07-18 22:44:17 +02:00
|
|
|
|
2023-07-22 02:35:49 +02:00
|
|
|
it('renders valid HTML', async () => {
|
2020-07-18 22:44:17 +02:00
|
|
|
const htmlvalidate = new HtmlValidate({
|
2021-02-14 15:18:58 +01:00
|
|
|
extends: ['html-validate:recommended'],
|
2023-01-30 02:38:45 +01:00
|
|
|
rules: {
|
|
|
|
'no-trailing-whitespace': 'off',
|
|
|
|
'tel-non-breaking': 'off',
|
|
|
|
},
|
2020-07-18 22:44:17 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
const {
|
|
|
|
results: [{ messages } = {}],
|
2023-07-22 02:35:49 +02:00
|
|
|
} = await htmlvalidate.validateString(render(resume))
|
2020-07-18 22:44:17 +02:00
|
|
|
|
2023-01-31 02:37:41 +01:00
|
|
|
expect(messages).toBeUndefined()
|
2020-07-18 22:44:17 +02:00
|
|
|
})
|