Repository: gitify-app/gitify
Pull request #1061 (2024-04-23 18:35:14)

refactor: use status type (loading, error, success)
Thanks @mattpocock for [todays inspiration](https://www.linkedin.com/feed/update/urn:li:activity:7188480362300211200?updateEntityUrn=urn%3Ali%3Afs_feedUpdate%3A%28V2%2Curn%3Ali%3Aactivity%3A7188480362300211200%29)



Patch:
diff --git a/src/components/Loading.tsx b/src/components/Loading.tsx
index 18c1dc15..ad1fc4c2 100644
--- a/src/components/Loading.tsx
+++ b/src/components/Loading.tsx
@@ -4,7 +4,7 @@ import { useContext, useEffect } from 'react';
 import { AppContext } from '../context/App';
 
 export const Loading = () => {
-  const { isFetching } = useContext(AppContext);
+  const { status } = useContext(AppContext);
 
   useEffect(() => {
     NProgress.configure({
@@ -17,12 +17,12 @@ export const Loading = () => {
   }, []);
 
   useEffect(() => {
-    if (isFetching) {
+    if (status === 'loading') {
       NProgress.start();
     } else {
       NProgress.done();
     }
-  }, [isFetching]);
+  }, [status]);
 
   return null;
 };
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 216e5b2a..e47171b0 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -19,7 +19,7 @@ export const Sidebar: FC = () => {
   const navigate = useNavigate();
   const location = useLocation();
 
-  const { notifications, fetchNotifications, isLoggedIn, isFetching } =
+  const { notifications, fetchNotifications, isLoggedIn, status } =
     useContext(AppContext);
 
   const onOpenBrowser = useCallback(() => {
@@ -81,15 +81,14 @@ export const Sidebar: FC = () => {
                 navigate('/', { replace: true });
                 fetchNotifications();
               }}
-              disabled={isFetching}
+              disabled={status === 'loading'}
             >
               <SyncIcon
                 size={16}
                 aria-label="Refresh Notifications"
-                className={isFetching ? 'animate-spin' : undefined}
+                className={status === 'loading' ? 'animate-spin' : undefined}
               />
             </button>
-
             <button
               type="button"
               className={sidebarButtonClasses}
diff --git a/src/context/App.tsx b/src/context/App.tsx
index 3f4f1464..c240cc85 100644
--- a/src/context/App.tsx
+++ b/src/context/App.tsx
@@ -16,6 +16,7 @@ import {
   type AuthTokenOptions,
   type GitifyError,
   type SettingsState,
+  type Status,
   Theme,
 } from '../types';
 import { headNotifications } from '../utils/api/client';
@@ -54,8 +55,7 @@ interface AppContextState {
   logout: () => void;
 
   notifications: AccountNotifications[];
-  isFetching: boolean;
-  requestFailed: boolean;
+  status: Status;
   errorDetails: GitifyError;
   removeNotificationFromState: (id: string, hostname: string) => void;
   fetchNotifications: () => Promise<void>;
@@ -80,9 +80,8 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
   const {
     fetchNotifications,
     notifications,
-    requestFailed,
     errorDetails,
-    isFetching,
+    status,
     removeNotificationFromState,
     markNotificationRead,
     markNotificationDone,
@@ -239,8 +238,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
         logout,
 
         notifications,
-        isFetching,
-        requestFailed,
+        status,
         errorDetails,
         removeNotificationFromState,
         fetchNotifications: fetchNotificationsWithAccounts,
diff --git a/src/hooks/useNotifications.ts b/src/hooks/useNotifications.ts
index a2841a82..cd1fced8 100644
--- a/src/hooks/useNotifications.ts
+++ b/src/hooks/useNotifications.ts
@@ -6,6 +6,7 @@ import type {
   AuthState,
   GitifyError,
   SettingsState,
+  Status,
 } from '../types';
 import type { GitHubRESTError, Notification } from '../typesGitHub';
 import {
@@ -63,14 +64,12 @@ interface NotificationsState {
     repoSlug: string,
     hostname: string,
   ) => Promise<void>;
-  isFetching: boolean;
-  requestFailed: boolean;
+  status: Status;
   errorDetails: GitifyError;
 }
 
 export const useNotifications = (): NotificationsState => {
-  const [isFetching, setIsFetching] = useState(false);
-  const [requestFailed, setRequestFailed] = useState(false);
+  const [status, setStatus] = useState<Status>('success');
   const [errorDetails, setErrorDetails] = useState<GitifyError>();
 
   const [notifications, setNotifications] = useState<AccountNotifications[]>(
@@ -101,13 +100,12 @@ export const useNotifications = (): NotificationsState => {
         });
       }
 
-      setIsFetching(true);
+      setStatus('loading');
 
       return axios
         .all([getGitHubNotifications(), ...getEnterpriseNotifications()])
         .then(
           axios.spread((gitHubNotifications, ...entAccNotifications) => {
-            setRequestFailed(false);
             const enterpriseNotifications = entAccNotifications.map(
               (accountNotifications) => {
                 const { hostname } = new URL(accountNotifications.config.url);
@@ -199,13 +197,12 @@ export const useNotifications = (): NotificationsState => {
                   settings,
                   accounts,
                 );
-                setIsFetching(false);
+                setStatus('success');
               });
           }),
         )
         .catch((err: AxiosError<GitHubRESTError>) => {
-          setIsFetching(false);
-          setRequestFailed(true);
+          setStatus('error');
           setErrorDetails(determineFailureType(err));
         });
     },
@@ -214,7 +211,7 @@ export const useNotifications = (): NotificationsState => {
 
   const markNotificationRead = useCallback(
     async (accounts: AuthState, id: string, hostname: string) => {
-      setIsFetching(true);
+      setStatus('loading');
 
       const isEnterprise = isEnterpriseHost(hostname);
       const token = isEnterprise
@@ -232,9 +229,9 @@ export const useNotifications = (): NotificationsState => {
 
         setNotifications(updatedNotifications);
         setTrayIconColor(updatedNotifications);
-        setIsFetching(false);
+        setStatus('success');
       } catch (err) {
-        setIsFetching(false);
+        setStatus('success');
       }
     },
     [notifications],
@@ -242,7 +239,7 @@ export const useNotifications = (): NotificationsState => {
 
   const markNotificationDone = useCallback(
     async (accounts: AuthState, id: string, hostname: string) => {
-      setIsFetching(true);
+      setStatus('loading');
 
       const isEnterprise = isEnterpriseHost(hostname);
       const token = isEnterprise
@@ -260,9 +257,9 @@ export const useNotifications = (): NotificationsState => {
 
         setNotifications(updatedNotifications);
         setTrayIconColor(updatedNotifications);
-        setIsFetching(false);
+        setStatus('success');
       } catch (err) {
-        setIsFetching(false);
+        setStatus('success');
       }
     },
     [notifications],
@@ -270,7 +267,7 @@ export const useNotifications = (): NotificationsState => {
 
   const unsubscribeNotification = useCallback(
     async (accounts: AuthState, id: string, hostname: string) => {
-      setIsFetching(true);
+      setStatus('loading');
 
       const isEnterprise = isEnterpriseHost(hostname);
       const token = isEnterprise
@@ -280,8 +277,9 @@ export const useNotifications = (): NotificationsState => {
       try {
         await ignoreNotificationThreadSubscription(id, hostname, token);
         await markNotificationRead(accounts, id, hostname);
+        setStatus('success');
       } catch (err) {
-        setIsFetching(false);
+        setStatus('success');
       }
     },
     [notifications],
@@ -289,7 +287,7 @@ export const useNotifications = (): NotificationsState => {
 
   const markRepoNotifications = useCallback(
     async (accounts: AuthState, repoSlug: string, hostname: string) => {
-      setIsFetching(true);
+      setStatus('loading');
 
       const isEnterprise = isEnterpriseHost(hostname);
       const token = isEnterprise
@@ -306,9 +304,9 @@ export const useNotifications = (): NotificationsState => {
 
         setNotifications(updatedNotifications);
         setTrayIconColor(updatedNotifications);
-        setIsFetching(false);
+        setStatus('success');
       } catch (err) {
-        setIsFetching(false);
+        setStatus('success');
       }
     },
     [notifications],
@@ -316,7 +314,7 @@ export const useNotifications = (): NotificationsState => {
 
   const markRepoNotificationsDone = useCallback(
     async (accounts: AuthState, repoSlug: string, hostname: string) => {
-      setIsFetching(true);
+      setStatus('loading');
 
       try {
         const accountIndex = notifications.findIndex(
@@ -349,9 +347,9 @@ export const useNotifications = (): NotificationsState => {
 
         setNotifications(updatedNotifications);
         setTrayIconColor(updatedNotifications);
-        setIsFetching(false);
+        setStatus('success');
       } catch (err) {
-        setIsFetching(false);
+        setStatus('success');
       }
     },
     [notifications],
@@ -372,8 +370,7 @@ export const useNotifications = (): NotificationsState => {
   );
 
   return {
-    isFetching,
-    requestFailed,
+    status,
     errorDetails,
     notifications,
 
diff --git a/src/routes/Notifications.tsx b/src/routes/Notifications.tsx
index f006efe2..54d375ba 100644
--- a/src/routes/Notifications.tsx
+++ b/src/routes/Notifications.tsx
@@ -8,7 +8,7 @@ import { Errors } from '../utils/constants';
 import { getNotificationCount } from '../utils/notifications';
 
 export const NotificationsRoute: FC = () => {
-  const { notifications, requestFailed, errorDetails, settings } =
+  const { notifications, status, errorDetails, settings } =
     useContext(AppContext);
 
   const hasMultipleAccounts = useMemo(
@@ -24,7 +24,7 @@ export const NotificationsRoute: FC = () => {
     [notificationsCount],
   );
 
-  if (requestFailed) {
+  if (status === 'error') {
     return <Oops error={errorDetails ?? Errors.UNKNOWN} />;
   }
 
diff --git a/src/types.ts b/src/types.ts
index fde42cc5..70adfd7a 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -6,6 +6,8 @@ export interface AuthState {
   user: GitifyUser | null;
 }
 
+export type Status = 'loading' | 'success' | 'error';
+
 export type SettingsState = AppearanceSettingsState &
   NotificationSettingsState &
   SystemSettingsState;


Test patch:
diff --git a/src/components/Loading.test.tsx b/src/components/Loading.test.tsx
index 80a1c02f..7880133d 100644
--- a/src/components/Loading.test.tsx
+++ b/src/components/Loading.test.tsx
@@ -16,9 +16,9 @@ describe('components/Loading.tsx', () => {
     jest.clearAllMocks();
   });
 
-  it('should check that NProgress is getting called in when isFetching changes (loading)', () => {
+  it('should check that NProgress is getting called in when status changes (loading)', () => {
     const { container } = render(
-      <AppContext.Provider value={{ isFetching: true }}>
+      <AppContext.Provider value={{ status: 'loading' }}>
         <Loading />
       </AppContext.Provider>,
     );
@@ -28,9 +28,9 @@ describe('components/Loading.tsx', () => {
     expect(NProgress.start).toHaveBeenCalledTimes(1);
   });
 
-  it('should check that NProgress is getting called in when isFetching changes (not loading)', () => {
+  it('should check that NProgress is getting called in when status changes (not loading)', () => {
     const { container } = render(
-      <AppContext.Provider value={{ isFetching: false }}>
+      <AppContext.Provider value={{ status: 'success' }}>
         <Loading />
       </AppContext.Provider>,
     );
@@ -42,7 +42,7 @@ describe('components/Loading.tsx', () => {
 
   it('should remove NProgress on unmount', () => {
     const { unmount } = render(
-      <AppContext.Provider value={{ isFetching: true }}>
+      <AppContext.Provider value={{ status: 'loading' }}>
         <Loading />
       </AppContext.Provider>,
     );
diff --git a/src/hooks/useNotifications.test.ts b/src/hooks/useNotifications.test.ts
index 6eb889fc..018ea1b8 100644
--- a/src/hooks/useNotifications.test.ts
+++ b/src/hooks/useNotifications.test.ts
@@ -37,10 +37,10 @@ describe('hooks/useNotifications.ts', () => {
           result.current.fetchNotifications(mockAccounts, mockSettings);
         });
 
-        expect(result.current.isFetching).toBe(true);
+        expect(result.current.status).toBe('loading');
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications[0].hostname).toBe(
@@ -84,13 +84,13 @@ describe('hooks/useNotifications.ts', () => {
           result.current.fetchNotifications(mockAccounts, mockSettings);
         });
 
-        expect(result.current.isFetching).toBe(true);
+        expect(result.current.status).toBe('loading');
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('error');
         });
 
-        expect(result.current.requestFailed).toBe(true);
+        expect(result.current.errorDetails).toBe(Errors.UNKNOWN);
       });
     });
 
@@ -150,7 +150,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.requestFailed).toBe(true);
+          expect(result.current.status).toBe('error');
         });
       });
     });
@@ -210,14 +210,14 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.requestFailed).toBe(true);
+          expect(result.current.status).toBe('error');
           expect(result.current.errorDetails).toBe(Errors.UNKNOWN);
         });
       });
     });
 
-    describe('with colors', () => {
-      it('should fetch notifications with success - with colors', async () => {
+    describe('with detailed notifications', () => {
+      it('should fetch notifications with success', async () => {
         const accounts: AuthState = {
           ...mockAccounts,
           enterpriseAccounts: [],
@@ -373,12 +373,13 @@ describe('hooks/useNotifications.ts', () => {
           });
         });
 
-        expect(result.current.isFetching).toBe(true);
+        expect(result.current.status).toBe('loading');
 
         await waitFor(() => {
-          expect(result.current.notifications[0].hostname).toBe('github.com');
+          expect(result.current.status).toBe('success');
         });
 
+        expect(result.current.notifications[0].hostname).toBe('github.com');
         expect(result.current.notifications[0].notifications.length).toBe(6);
       });
     });
@@ -452,12 +453,13 @@ describe('hooks/useNotifications.ts', () => {
           });
         });
 
-        expect(result.current.isFetching).toBe(true);
+        expect(result.current.status).toBe('loading');
 
         await waitFor(() => {
-          expect(result.current.notifications[0].hostname).toBe('github.com');
+          expect(result.current.status).toBe('success');
         });
 
+        expect(result.current.notifications[0].hostname).toBe('github.com');
         expect(result.current.notifications[0].notifications.length).toBe(1);
       });
     });
@@ -485,7 +487,7 @@ describe('hooks/useNotifications.ts', () => {
       });
 
       await waitFor(() => {
-        expect(result.current.isFetching).toBe(false);
+        expect(result.current.status).toBe('success');
       });
 
       act(() => {
@@ -518,7 +520,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -536,7 +538,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -548,7 +550,7 @@ describe('hooks/useNotifications.ts', () => {
       const hostname = 'github.gitify.io';
 
       it('should mark a notification as read with success - enterprise', async () => {
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .patch(`/notifications/threads/${id}`)
           .reply(200);
 
@@ -559,14 +561,14 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
       });
 
       it('should mark a notification as read with failure - enterprise', async () => {
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .patch(`/notifications/threads/${id}`)
           .reply(400);
 
@@ -577,7 +579,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -604,7 +606,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -622,7 +624,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -634,7 +636,7 @@ describe('hooks/useNotifications.ts', () => {
       const hostname = 'github.gitify.io';
 
       it('should mark a notification as done with success - enterprise', async () => {
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .delete(`/notifications/threads/${id}`)
           .reply(200);
 
@@ -645,14 +647,14 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
       });
 
       it('should mark a notification as done with failure - enterprise', async () => {
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .delete(`/notifications/threads/${id}`)
           .reply(400);
 
@@ -663,7 +665,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -696,7 +698,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -720,7 +722,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -733,12 +735,12 @@ describe('hooks/useNotifications.ts', () => {
 
       it('should unsubscribe from a notification with success - enterprise', async () => {
         // The unsubscribe endpoint call.
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .put(`/notifications/threads/${id}/subscription`)
           .reply(200);
 
         // The mark read endpoint call.
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .patch(`/notifications/threads/${id}`)
           .reply(200);
 
@@ -749,7 +751,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -757,12 +759,12 @@ describe('hooks/useNotifications.ts', () => {
 
       it('should unsubscribe from a notification with failure - enterprise', async () => {
         // The unsubscribe endpoint call.
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .put(`/notifications/threads/${id}/subscription`)
           .reply(400);
 
         // The mark read endpoint call.
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .patch(`/notifications/threads/${id}`)
           .reply(400);
 
@@ -773,7 +775,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -800,7 +802,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -818,7 +820,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -830,7 +832,7 @@ describe('hooks/useNotifications.ts', () => {
       const hostname = 'github.gitify.io';
 
       it("should mark a repository's notifications as read with success - enterprise", async () => {
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .put(`/repos/${repoSlug}/notifications`)
           .reply(200);
 
@@ -841,14 +843,14 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
       });
 
       it("should mark a repository's notifications as read with failure - enterprise", async () => {
-        nock('https://github.gitify.io/')
+        nock('https://github.gitify.io/api/v3')
           .put(`/repos/${repoSlug}/notifications`)
           .reply(400);
 
@@ -859,7 +861,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -891,7 +893,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -913,7 +915,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
@@ -925,7 +927,7 @@ describe('hooks/useNotifications.ts', () => {
       const hostname = 'github.gitify.io';
 
       it("should mark a repository's notifications as done with success - enterprise", async () => {
-        nock('https://api.github.com/')
+        nock('https://github.gitify.io/api/v3')
           .delete(`/notifications/threads/${id}`)
           .reply(200);
 
@@ -940,14 +942,14 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
       });
 
       it("should mark a repository's notifications as done with failure - enterprise", async () => {
-        nock('https://api.github.com/')
+        nock('https://github.gitify.io/api/v3')
           .delete(`/notifications/threads/${id}`)
           .reply(400);
 
@@ -962,7 +964,7 @@ describe('hooks/useNotifications.ts', () => {
         });
 
         await waitFor(() => {
-          expect(result.current.isFetching).toBe(false);
+          expect(result.current.status).toBe('success');
         });
 
         expect(result.current.notifications.length).toBe(0);
diff --git a/src/routes/Notifications.test.tsx b/src/routes/Notifications.test.tsx
index b46e0f27..155a274b 100644
--- a/src/routes/Notifications.test.tsx
+++ b/src/routes/Notifications.test.tsx
@@ -60,7 +60,7 @@ describe('routes/Notifications.tsx', () => {
         <AppContext.Provider
           value={{
             notifications: [],
-            requestFailed: true,
+            status: 'error',
             errorDetails: Errors.BAD_CREDENTIALS,
           }}
         >
@@ -76,7 +76,7 @@ describe('routes/Notifications.tsx', () => {
         <AppContext.Provider
           value={{
             notifications: [],
-            requestFailed: true,
+            status: 'error',
             errorDetails: Errors.MISSING_SCOPES,
           }}
         >
@@ -92,7 +92,7 @@ describe('routes/Notifications.tsx', () => {
         <AppContext.Provider
           value={{
             notifications: [],
-            requestFailed: true,
+            status: 'error',
             errorDetails: Errors.RATE_LIMITED,
           }}
         >
@@ -108,7 +108,7 @@ describe('routes/Notifications.tsx', () => {
         <AppContext.Provider
           value={{
             notifications: [],
-            requestFailed: true,
+            status: 'error',
             errorDetails: Errors.UNKNOWN,
           }}
         >
@@ -124,7 +124,7 @@ describe('routes/Notifications.tsx', () => {
         <AppContext.Provider
           value={{
             notifications: [],
-            requestFailed: true,
+            status: 'error',
             errorDetails: null,
           }}
         >