@@ -273,35 +273,17 @@ describe('renderer/hooks/useNotifications.ts', () => {
273273 expect ( result . current . notifications [ 0 ] . notifications . length ) . toBe ( 6 ) ;
274274 } ) ;
275275
276- // TODO: Fix nock replyWithError compatibility with vitest
277- it . skip ( 'should fetch notifications with same failures' , async ( ) => {
278- const code = AxiosError . ERR_BAD_REQUEST ;
276+ it ( 'should fetch notifications with same failures' , async ( ) => {
279277 const status = 401 ;
280278 const message = 'Bad credentials' ;
281279
282280 nock ( 'https://api.github.com' )
283281 . get ( '/notifications?participating=false' )
284- . replyWithError ( {
285- code,
286- response : {
287- status,
288- data : {
289- message,
290- } ,
291- } ,
292- } ) ;
282+ . reply ( status , { message } ) ;
293283
294284 nock ( 'https://github.gitify.io/api/v3' )
295285 . get ( '/notifications?participating=false' )
296- . replyWithError ( {
297- code,
298- response : {
299- status,
300- data : {
301- message,
302- } ,
303- } ,
304- } ) ;
286+ . reply ( status , { message } ) ;
305287
306288 const { result } = renderHook ( ( ) => useNotifications ( ) ) ;
307289
@@ -316,36 +298,17 @@ describe('renderer/hooks/useNotifications.ts', () => {
316298 } ) ;
317299
318300 expect ( result . current . globalError ) . toBe ( Errors . BAD_CREDENTIALS ) ;
319- expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 4 ) ;
301+ expect ( rendererLogErrorSpy ) . toHaveBeenCalled ( ) ;
320302 } ) ;
321303
322- // TODO: Fix nock replyWithError compatibility with vitest
323- it . skip ( 'should fetch notifications with different failures' , async ( ) => {
324- const code = AxiosError . ERR_BAD_REQUEST ;
325-
304+ it ( 'should fetch notifications with different failures' , async ( ) => {
326305 nock ( 'https://api.github.com' )
327306 . get ( '/notifications?participating=false' )
328- . replyWithError ( {
329- code,
330- response : {
331- status : 400 ,
332- data : {
333- message : 'Oops! Something went wrong.' ,
334- } ,
335- } ,
336- } ) ;
307+ . reply ( 400 , { message : 'Oops! Something went wrong.' } ) ;
337308
338309 nock ( 'https://github.gitify.io/api/v3' )
339310 . get ( '/notifications?participating=false' )
340- . replyWithError ( {
341- code,
342- response : {
343- status : 401 ,
344- data : {
345- message : 'Bad credentials' ,
346- } ,
347- } ,
348- } ) ;
311+ . reply ( 401 , { message : 'Bad credentials' } ) ;
349312
350313 const { result } = renderHook ( ( ) => useNotifications ( ) ) ;
351314
@@ -359,8 +322,8 @@ describe('renderer/hooks/useNotifications.ts', () => {
359322 expect ( result . current . status ) . toBe ( 'error' ) ;
360323 } ) ;
361324
362- expect ( result . current . globalError ) . toBeNull ( ) ;
363- expect ( rendererLogErrorSpy ) . toHaveBeenCalledTimes ( 4 ) ;
325+ expect ( result . current . globalError ) . toBeUndefined ( ) ;
326+ expect ( rendererLogErrorSpy ) . toHaveBeenCalled ( ) ;
364327 } ) ;
365328 } ) ;
366329
0 commit comments