@@ -3,8 +3,6 @@ import { act, renderHook, waitFor } from '@testing-library/react';
3
3
import axios , { AxiosError } from 'axios' ;
4
4
import nock from 'nock' ;
5
5
6
- import * as logger from '../../shared/logger' ;
7
-
8
6
import {
9
7
mockAuth ,
10
8
mockGitHubCloudAccount ,
@@ -16,16 +14,19 @@ import {
16
14
mockSingleNotification ,
17
15
} from '../utils/api/__mocks__/response-mocks' ;
18
16
import { Errors } from '../utils/errors' ;
17
+ import * as logger from '../utils/logger' ;
19
18
import { useNotifications } from './useNotifications' ;
20
19
21
20
describe ( 'renderer/hooks/useNotifications.ts' , ( ) => {
22
- const logErrorSpy = jest . spyOn ( logger , 'logError' ) . mockImplementation ( ) ;
21
+ const rendererLogErrorSpy = jest
22
+ . spyOn ( logger , 'rendererLogError' )
23
+ . mockImplementation ( ) ;
23
24
24
25
beforeEach ( ( ) => {
25
26
// axios will default to using the XHR adapter which can't be intercepted
26
27
// by nock. So, configure axios to use the node adapter.
27
28
axios . defaults . adapter = 'http' ;
28
- logErrorSpy . mockReset ( ) ;
29
+ rendererLogErrorSpy . mockReset ( ) ;
29
30
} ) ;
30
31
31
32
const id = mockSingleNotification . id ;
@@ -300,7 +301,7 @@ describe('renderer/hooks/useNotifications.ts', () => {
300
301
} ) ;
301
302
302
303
expect ( result . current . globalError ) . toBe ( Errors . BAD_CREDENTIALS ) ;
303
- expect ( logErrorSpy ) . toHaveBeenCalledTimes ( 4 ) ;
304
+ expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 4 ) ;
304
305
} ) ;
305
306
306
307
it ( 'should fetch notifications with different failures' , async ( ) => {
@@ -343,7 +344,7 @@ describe('renderer/hooks/useNotifications.ts', () => {
343
344
} ) ;
344
345
345
346
expect ( result . current . globalError ) . toBeNull ( ) ;
346
- expect ( logErrorSpy ) . toHaveBeenCalledTimes ( 4 ) ;
347
+ expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 4 ) ;
347
348
} ) ;
348
349
} ) ;
349
350
@@ -386,7 +387,7 @@ describe('renderer/hooks/useNotifications.ts', () => {
386
387
} ) ;
387
388
388
389
expect ( result . current . notifications . length ) . toBe ( 0 ) ;
389
- expect ( logErrorSpy ) . toHaveBeenCalledTimes ( 1 ) ;
390
+ expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 1 ) ;
390
391
} ) ;
391
392
} ) ;
392
393
@@ -429,7 +430,7 @@ describe('renderer/hooks/useNotifications.ts', () => {
429
430
} ) ;
430
431
431
432
expect ( result . current . notifications . length ) . toBe ( 0 ) ;
432
- expect ( logErrorSpy ) . toHaveBeenCalledTimes ( 1 ) ;
433
+ expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 1 ) ;
433
434
} ) ;
434
435
} ) ;
435
436
@@ -521,7 +522,7 @@ describe('renderer/hooks/useNotifications.ts', () => {
521
522
} ) ;
522
523
523
524
expect ( result . current . notifications . length ) . toBe ( 0 ) ;
524
- expect ( logErrorSpy ) . toHaveBeenCalledTimes ( 1 ) ;
525
+ expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 1 ) ;
525
526
} ) ;
526
527
} ) ;
527
528
} ) ;
0 commit comments