test(css): invalid option

This commit is contained in:
curbengh 2019-12-26 15:32:21 +00:00
parent f7c600545b
commit 4e4605e1a4
No known key found for this signature in database
GPG Key ID: 21EA847C35D6E034
1 changed files with 23 additions and 0 deletions

View File

@ -139,6 +139,29 @@ describe('css', () => {
expect(result).toBe(styles)
})
test('option - invalid', async () => {
const customOpt = {
level: 9000
}
hexo.config.minify.css = customOpt
const input = 'foo { bar: baz; } foo { aaa: bbb; }'
let result, expected
try {
await c(input, { path: '' })
} catch (err) {
result = err.message
}
try {
await new CleanCSS(customOpt).minify(input)
} catch (err) {
expected = err.message
}
expect(result).toContain(expected)
})
test('exclude - *.min.css', async () => {
const input = 'foo { bar: baz; } foo { aaa: bbb; }'
const result = await c(input, { path: 'foo/bar.min.css' })