2023-07-02 12:18:21 +02:00
|
|
|
import test from 'node:test'
|
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
2022-04-06 19:59:31 +02:00
|
|
|
import { execa } from 'execa'
|
2022-01-06 22:34:58 +01:00
|
|
|
|
2022-01-06 19:52:25 +01:00
|
|
|
import { cli } from '../cli.js'
|
|
|
|
import { HTMLValidatorCommand } from '../HTMLValidatorCommand.js'
|
|
|
|
|
2023-07-02 12:18:21 +02:00
|
|
|
await test('html-w3c-validator', async (t) => {
|
|
|
|
await t.test('should be instance of the command', async () => {
|
2022-01-06 19:52:25 +01:00
|
|
|
const command = cli.process([])
|
2023-07-02 12:18:21 +02:00
|
|
|
assert(command instanceof HTMLValidatorCommand)
|
2022-01-06 19:52:25 +01:00
|
|
|
})
|
|
|
|
|
2023-07-02 12:18:21 +02:00
|
|
|
await t.test('succeeds and validate the html correctly', async () => {
|
2022-04-06 19:59:31 +02:00
|
|
|
const exampleURL = new URL('../../example', import.meta.url)
|
|
|
|
process.chdir(exampleURL.pathname)
|
2022-01-06 22:34:58 +01:00
|
|
|
await execa('rimraf', ['node_modules'])
|
|
|
|
await execa('npm', ['install'])
|
|
|
|
const { exitCode } = await execa('npm', ['run', 'test:html-w3c-validator'])
|
2023-07-02 12:18:21 +02:00
|
|
|
assert.strictEqual(exitCode, 0)
|
2022-01-06 19:52:25 +01:00
|
|
|
})
|
|
|
|
})
|