react-native-web-headroom
Version:
React Native Web Headroom
29 lines (27 loc) • 969 B
JavaScript
import { logger } from './.';
describe('client-logger', () => {
const initialConsole = { ...global.console };
beforeEach(() => {
global.console.log = jest.fn();
global.console.warn = jest.fn();
global.console.error = jest.fn();
});
afterAll(() => {
global.console = initialConsole;
});
it('should have an info method that displays the message', () => {
const message = 'information';
logger.info(message);
expect(global.console.log).toHaveBeenCalledWith(message);
});
it('should have a warning method that displays the message in yellow, with a trace', () => {
const message = 'warning message';
logger.warn(message);
expect(global.console.warn).toHaveBeenCalledWith(message);
});
it('should have an error method that displays the message in red, with a trace', () => {
const message = 'error message';
logger.error(message);
expect(global.console.error).toHaveBeenCalledWith(message);
});
});