test(logger): add test

This commit is contained in:
curbengh 2019-12-27 08:55:39 +00:00
parent 866593110e
commit 1a5197b9c9
No known key found for this signature in database
GPG Key ID: 21EA847C35D6E034
1 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,16 @@ describe('html', () => {
expect(result).toBe(expected)
})
it('option - logger', () => {
hexo.config.minify.html.logger = true
const path = 'foo'
hexo.log.log = jest.fn()
const input = '<p>foo</p>'
h(input, { path })
expect(hexo.log.log).toHaveBeenCalled()
expect(hexo.log.log).toHaveBeenCalledWith(`html: ${path} [0.00% saved]`)
})
test('exclude', () => {
const exclude = '*.min.html'
hexo.config.minify.html.exclude = exclude