1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-22 08:11:34 +03:00
leon/test/unit/server/helpers/log.spec.js
2021-03-03 17:09:31 +08:00

52 lines
1.3 KiB
JavaScript

import log from '@/helpers/log'
describe('log helper', () => {
describe('success()', () => {
test('logs success', () => {
console.log = jest.fn()
log.success('This is a success')
expect(console.log.mock.calls[0][1]).toBe('This is a success')
})
})
describe('info()', () => {
test('logs info', () => {
console.info = jest.fn()
log.info('This is an info')
expect(console.info.mock.calls[0][1]).toBe('This is an info')
})
})
describe('error()', () => {
test('logs error', () => {
console.error = jest.fn()
log.error('This is an error')
expect(console.error.mock.calls[0][1]).toBe('This is an error')
})
})
describe('warning()', () => {
test('logs warning', () => {
console.warn = jest.fn()
log.warning('This is a warning')
expect(console.warn.mock.calls[0][1]).toBe('This is a warning')
})
})
describe('title()', () => {
test('logs title', () => {
console.log = jest.fn()
log.title('This is a title')
expect(console.log.mock.calls[0][1]).toBe('THIS IS A TITLE')
})
})
describe('default()', () => {
test('logs default', () => {
console.log = jest.fn()
log.default('This is a default')
expect(console.log.mock.calls[0][1]).toBe('This is a default')
})
})
})