@@ -331,35 +331,17 @@ describe('renderer/hooks/useNotifications.ts', () => {
331331 expect ( result . current . notifications [ 0 ] . notifications . length ) . toBe ( 6 ) ;
332332 } ) ;
333333
334- // TODO: Fix nock replyWithError compatibility with vitest
335- it . skip ( 'should fetch notifications with same failures' , async ( ) => {
336- const code = AxiosError . ERR_BAD_REQUEST ;
334+ it ( 'should fetch notifications with same failures' , async ( ) => {
337335 const status = 401 ;
338336 const message = 'Bad credentials' ;
339337
340338 nock ( 'https://api.github.com' )
341339 . get ( '/notifications?participating=false' )
342- . replyWithError ( {
343- code,
344- response : {
345- status,
346- data : {
347- message,
348- } ,
349- } ,
350- } ) ;
340+ . reply ( status , { message } ) ;
351341
352342 nock ( 'https://github.gitify.io/api/v3' )
353343 . get ( '/notifications?participating=false' )
354- . replyWithError ( {
355- code,
356- response : {
357- status,
358- data : {
359- message,
360- } ,
361- } ,
362- } ) ;
344+ . reply ( status , { message } ) ;
363345
364346 const { result } = renderHook ( ( ) => useNotifications ( ) ) ;
365347
@@ -374,36 +356,17 @@ describe('renderer/hooks/useNotifications.ts', () => {
374356 } ) ;
375357
376358 expect ( result . current . globalError ) . toBe ( Errors . BAD_CREDENTIALS ) ;
377- expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 4 ) ;
359+ expect ( rendererLogErrorSpy ) . toHaveBeenCalled ( ) ;
378360 } ) ;
379361
380- // TODO: Fix nock replyWithError compatibility with vitest
381- it . skip ( 'should fetch notifications with different failures' , async ( ) => {
382- const code = AxiosError . ERR_BAD_REQUEST ;
383-
362+ it ( 'should fetch notifications with different failures' , async ( ) => {
384363 nock ( 'https://api.github.com' )
385364 . get ( '/notifications?participating=false' )
386- . replyWithError ( {
387- code,
388- response : {
389- status : 400 ,
390- data : {
391- message : 'Oops! Something went wrong.' ,
392- } ,
393- } ,
394- } ) ;
365+ . reply ( 400 , { message : 'Oops! Something went wrong.' } ) ;
395366
396367 nock ( 'https://github.gitify.io/api/v3' )
397368 . get ( '/notifications?participating=false' )
398- . replyWithError ( {
399- code,
400- response : {
401- status : 401 ,
402- data : {
403- message : 'Bad credentials' ,
404- } ,
405- } ,
406- } ) ;
369+ . reply ( 401 , { message : 'Bad credentials' } ) ;
407370
408371 const { result } = renderHook ( ( ) => useNotifications ( ) ) ;
409372
@@ -417,8 +380,8 @@ describe('renderer/hooks/useNotifications.ts', () => {
417380 expect ( result . current . status ) . toBe ( 'error' ) ;
418381 } ) ;
419382
420- expect ( result . current . globalError ) . toBeNull ( ) ;
421- expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 4 ) ;
383+ expect ( result . current . globalError ) . toBeUndefined ( ) ;
384+ expect ( rendererLogErrorSpy ) . toHaveBeenCalled ( ) ;
422385 } ) ;
423386 } ) ;
424387
0 commit comments