2022-09-21 15:25:00 +03:00
|
|
|
import { LOG } from '@/helpers/log'
|
2019-02-10 15:26:50 +03:00
|
|
|
|
|
|
|
describe('log helper', () => {
|
|
|
|
describe('success()', () => {
|
|
|
|
test('logs success', () => {
|
|
|
|
console.log = jest.fn()
|
2022-09-21 15:25:00 +03:00
|
|
|
LOG.success('This is a success')
|
2019-02-10 15:26:50 +03:00
|
|
|
expect(console.log.mock.calls[0][1]).toBe('This is a success')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('info()', () => {
|
|
|
|
test('logs info', () => {
|
|
|
|
console.info = jest.fn()
|
2022-09-21 15:25:00 +03:00
|
|
|
LOG.info('This is an info')
|
2019-02-10 15:26:50 +03:00
|
|
|
expect(console.info.mock.calls[0][1]).toBe('This is an info')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('error()', () => {
|
|
|
|
test('logs error', () => {
|
|
|
|
console.error = jest.fn()
|
2022-09-21 15:25:00 +03:00
|
|
|
LOG.error('This is an error')
|
2019-02-10 15:26:50 +03:00
|
|
|
expect(console.error.mock.calls[0][1]).toBe('This is an error')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('warning()', () => {
|
|
|
|
test('logs warning', () => {
|
|
|
|
console.warn = jest.fn()
|
2022-09-21 15:25:00 +03:00
|
|
|
LOG.warning('This is a warning')
|
2019-02-10 15:26:50 +03:00
|
|
|
expect(console.warn.mock.calls[0][1]).toBe('This is a warning')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('title()', () => {
|
|
|
|
test('logs title', () => {
|
|
|
|
console.log = jest.fn()
|
2022-09-21 15:25:00 +03:00
|
|
|
LOG.title('This is a title')
|
2019-02-10 15:26:50 +03:00
|
|
|
expect(console.log.mock.calls[0][1]).toBe('THIS IS A TITLE')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('default()', () => {
|
|
|
|
test('logs default', () => {
|
|
|
|
console.log = jest.fn()
|
2022-09-21 15:25:00 +03:00
|
|
|
LOG.default('This is a default')
|
2019-02-10 15:26:50 +03:00
|
|
|
expect(console.log.mock.calls[0][1]).toBe('This is a default')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|