diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-07 12:11:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-07 12:11:43 +0300 |
commit | 378308b6cde44eb1a320b9202ff8946a911f35f6 (patch) | |
tree | 3031a645455dbbcdb2961dd09c15100fa28ed8e1 /spec/frontend/lib/logger/index_spec.js | |
parent | 777dc3053f8433a9f5c9cc868325e16eac5d93e5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib/logger/index_spec.js')
-rw-r--r-- | spec/frontend/lib/logger/index_spec.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/frontend/lib/logger/index_spec.js b/spec/frontend/lib/logger/index_spec.js new file mode 100644 index 00000000000..9382fafe4de --- /dev/null +++ b/spec/frontend/lib/logger/index_spec.js @@ -0,0 +1,23 @@ +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); + }); + }); +}); |