1- import log from 'electron-log ' ;
1+ import * as logger from '../../shared/logger ' ;
22
33import { mockSingleNotification } from './api/__mocks__/response-mocks' ;
44import { rendererLogError , rendererLogInfo , rendererLogWarn } from './logger' ;
55
66describe ( 'renderer/utils/logger.ts' , ( ) => {
7- const logInfoSpy = jest . spyOn ( log , 'info ' ) . mockImplementation ( ) ;
8- const logWarnSpy = jest . spyOn ( log , 'warn ' ) . mockImplementation ( ) ;
9- const logErrorSpy = jest . spyOn ( log , 'error ' ) . mockImplementation ( ) ;
7+ const logInfoSpy = jest . spyOn ( logger , 'logInfo ' ) . mockImplementation ( ) ;
8+ const logWarnSpy = jest . spyOn ( logger , 'logWarn ' ) . mockImplementation ( ) ;
9+ const logErrorSpy = jest . spyOn ( logger , 'logError ' ) . mockImplementation ( ) ;
1010 const mockError = new Error ( 'boom' ) ;
1111
1212 beforeEach ( ( ) => {
@@ -17,34 +17,33 @@ describe('renderer/utils/logger.ts', () => {
1717
1818 it ( 'logs info without notification' , ( ) => {
1919 rendererLogInfo ( 'foo' , 'bar' ) ;
20- expect ( logInfoSpy ) . toHaveBeenCalledWith ( '[ foo] ' , 'bar' ) ;
20+ expect ( logInfoSpy ) . toHaveBeenCalledWith ( 'foo' , 'bar' , [ ] ) ;
2121 } ) ;
2222
2323 it ( 'logs info with notification' , ( ) => {
2424 rendererLogInfo ( 'foo' , 'bar' , mockSingleNotification ) ;
25- expect ( logInfoSpy ) . toHaveBeenCalledWith (
26- '[foo] ' ,
27- 'bar ' ,
28- '[Issue >> gitify-app/notifications-test >> I am a robot and this is a test!] ' ,
29- ) ;
25+ expect ( logInfoSpy ) . toHaveBeenCalledWith ( 'foo' , 'bar' , [
26+ 'Issue ' ,
27+ 'gitify-app/notifications-test ' ,
28+ 'I am a robot and this is a test!' ,
29+ ] ) ;
3030 } ) ;
3131
3232 it ( 'logs warn with notification' , ( ) => {
3333 rendererLogWarn ( 'foo' , 'bar' , mockSingleNotification ) ;
34- expect ( logWarnSpy ) . toHaveBeenCalledWith (
35- '[foo] ' ,
36- 'bar ' ,
37- '[Issue >> gitify-app/notifications-test >> I am a robot and this is a test!] ' ,
38- ) ;
34+ expect ( logWarnSpy ) . toHaveBeenCalledWith ( 'foo' , 'bar' , [
35+ 'Issue ' ,
36+ 'gitify-app/notifications-test ' ,
37+ 'I am a robot and this is a test!' ,
38+ ] ) ;
3939 } ) ;
4040
4141 it ( 'logs error with notification' , ( ) => {
4242 rendererLogError ( 'foo' , 'bar' , mockError , mockSingleNotification ) ;
43- expect ( logErrorSpy ) . toHaveBeenCalledWith (
44- '[foo]' ,
45- 'bar' ,
46- '[Issue >> gitify-app/notifications-test >> I am a robot and this is a test!]' ,
47- mockError ,
48- ) ;
43+ expect ( logErrorSpy ) . toHaveBeenCalledWith ( 'foo' , 'bar' , mockError , [
44+ 'Issue' ,
45+ 'gitify-app/notifications-test' ,
46+ 'I am a robot and this is a test!' ,
47+ ] ) ;
4948 } ) ;
5049} ) ;
0 commit comments