2022-01-06 22:34:58 +01:00
|
|
|
import path from 'node:path'
|
|
|
|
|
|
|
|
import execa from 'execa'
|
|
|
|
|
2022-01-06 19:52:25 +01:00
|
|
|
import { cli } from '../cli.js'
|
|
|
|
import { HTMLValidatorCommand } from '../HTMLValidatorCommand.js'
|
|
|
|
|
|
|
|
describe('html-w3c-validator', () => {
|
|
|
|
afterEach(() => {
|
|
|
|
jest.clearAllMocks()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should be instance of the command', async () => {
|
|
|
|
const command = cli.process([])
|
|
|
|
expect(command).toBeInstanceOf(HTMLValidatorCommand)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('succeeds and validate the html correctly', async () => {
|
2022-01-06 22:34:58 +01:00
|
|
|
const examplePath = path.join(__dirname, '..', '..', 'example')
|
|
|
|
process.chdir(examplePath)
|
|
|
|
await execa('rimraf', ['node_modules'])
|
|
|
|
await execa('npm', ['install'])
|
|
|
|
const { exitCode } = await execa('npm', ['run', 'test:html-w3c-validator'])
|
2022-01-06 19:52:25 +01:00
|
|
|
expect(exitCode).toEqual(0)
|
|
|
|
})
|
|
|
|
})
|