mirror of https://github.com/curbengh/hexo-yam
test(br): test passing option
This commit is contained in:
parent
f0b37aaf45
commit
866593110e
|
@ -533,6 +533,22 @@ describe('brotli', () => {
|
||||||
expect(result).toBeUndefined()
|
expect(result).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('option', async () => {
|
||||||
|
const level = 1
|
||||||
|
hexo.config.minify.brotli.level = level
|
||||||
|
await b()
|
||||||
|
|
||||||
|
const output = hexo.route.get(path.concat('.br'))
|
||||||
|
const buf = []
|
||||||
|
output.on('data', (chunk) => (buf.push(chunk)))
|
||||||
|
output.on('end', async () => {
|
||||||
|
const result = Buffer.concat(buf)
|
||||||
|
const expected = await brotli(input, { params: { [zlib.constants.BROTLI_PARAM_QUALITY]: level } })
|
||||||
|
|
||||||
|
expect(result.toString('base64')).toBe(Buffer.from(expected, 'binary').toString('base64'))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
test('option - invalid', async () => {
|
test('option - invalid', async () => {
|
||||||
const level = 'foo'
|
const level = 'foo'
|
||||||
hexo.config.minify.brotli.level = level
|
hexo.config.minify.brotli.level = level
|
||||||
|
|
Loading…
Reference in New Issue