Skip to content

Commit

Permalink
(#1513) Update to test descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreenisrael committed Nov 25, 2017
1 parent 283f6dd commit fa16aa8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 34 deletions.
32 changes: 15 additions & 17 deletions lib/client-logger/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { logger } from './.';

describe('loggers', () => {
describe('client-logger', () => {
const initialConsole = { ...global.console };
beforeEach(() => {
global.console.log = jest.fn();
Expand All @@ -10,21 +10,19 @@ describe('loggers', () => {
afterAll(() => {
global.console = initialConsole;
});
describe('browser-logger', () => {
it('should have an info method with blue `Info`', () => {
const message = 'information';
logger.info(message);
expect(global.console.log).toHaveBeenCalledWith(message);
});
it('should have a warning method with yellow `Warn`', () => {
const message = 'warning message';
logger.warn(message);
expect(global.console.warn).toHaveBeenCalledWith(message);
});
it('should have an error method with red `Error`', () => {
const message = 'error message';
logger.error(message);
expect(global.console.error).toHaveBeenCalledWith(message);
});
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);
});
});
32 changes: 15 additions & 17 deletions lib/node-logger/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,25 @@ jest.mock('npmlog', () => ({
error: jest.fn(),
}));

describe('loggers', () => {
describe('node-logger', () => {
beforeEach(() => {
npmLog.info.mockReset();
npmLog.warn.mockReset();
npmLog.error.mockReset();
});
describe('node-logger', () => {
it('should have an info method', () => {
const message = 'information';
logger.info(message);
expect(npmLog.info).toHaveBeenCalledWith('', message);
});
it('should have a warn method', () => {
const message = 'warning message';
logger.warn(message);
expect(npmLog.warn).toHaveBeenCalledWith('', message);
});
it('should have an error method', () => {
const message = 'error message';
logger.error(message);
expect(npmLog.error).toHaveBeenCalledWith('', message);
});
it('should have an info method', () => {
const message = 'information';
logger.info(message);
expect(npmLog.info).toHaveBeenCalledWith('', message);
});
it('should have a warn method', () => {
const message = 'warning message';
logger.warn(message);
expect(npmLog.warn).toHaveBeenCalledWith('', message);
});
it('should have an error method', () => {
const message = 'error message';
logger.error(message);
expect(npmLog.error).toHaveBeenCalledWith('', message);
});
});

0 comments on commit fa16aa8

Please sign in to comment.