mirror of https://github.com/curbengh/hexo-yam
test(br): invalid level
This commit is contained in:
parent
1a5197b9c9
commit
e59e3866b9
|
@ -559,21 +559,20 @@ describe('brotli', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('option - invalid', async () => {
|
test('option - level is string', async () => {
|
||||||
const level = 'foo'
|
const level = 'foo'
|
||||||
hexo.config.minify.brotli.level = level
|
hexo.config.minify.brotli.level = level
|
||||||
|
await b()
|
||||||
|
|
||||||
let expected
|
const output = hexo.route.get(path.concat('.br'))
|
||||||
try {
|
const buf = []
|
||||||
await brotli(input, { params: { [zlib.constants.BROTLI_PARAM_QUALITY]: level } })
|
output.on('data', (chunk) => (buf.push(chunk)))
|
||||||
} catch (err) {
|
output.on('end', async () => {
|
||||||
expected = err.message
|
const result = Buffer.concat(buf)
|
||||||
}
|
const expected = await brotli(input, { params: { [zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY } })
|
||||||
try {
|
|
||||||
await b()
|
expect(result.toString('base64')).toBe(Buffer.from(expected, 'binary').toString('base64'))
|
||||||
} catch (err) {
|
})
|
||||||
expect(err.message).toContain(expected)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('include - exclude non-text file by default', async () => {
|
test('include - exclude non-text file by default', async () => {
|
||||||
|
|
Loading…
Reference in New Issue