gitlab-org--gitlab-foss/spec/frontend/lib/logger/index_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
611 B
JavaScript
Raw Normal View History

import { logError, LOG_PREFIX } from '~/lib/logger';
describe('~/lib/logger', () => {
let consoleErrorSpy;
beforeEach(() => {
consoleErrorSpy = jest.spyOn(console, 'error');
consoleErrorSpy.mockImplementation();
});
describe('logError', () => {
it('sends given message to console.error', () => {
const message = 'Lorem ipsum dolar sit amit';
const error = new Error('lorem ipsum');
expect(consoleErrorSpy).not.toHaveBeenCalled();
logError(message, error);
expect(consoleErrorSpy).toHaveBeenCalledWith(LOG_PREFIX, `${message}\n`, error);
});
});
});