Repository: gitify-app/gitify
Pull request #1150 (2024-05-28 09:30:15)

refactor(state): update state storage
Split from #1139 




Patch:
diff --git a/src/__mocks__/state-mocks.ts b/src/__mocks__/state-mocks.ts
index 4a701fab..9622c32c 100644
--- a/src/__mocks__/state-mocks.ts
+++ b/src/__mocks__/state-mocks.ts
@@ -19,7 +19,7 @@ export const mockUser: GitifyUser = {
   id: 123456789,
 };
 
-export const mockAccounts: AuthState = {
+export const mockAuth: AuthState = {
   token: 'token-123-456',
   enterpriseAccounts: mockEnterpriseAccounts,
   user: mockUser,
diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx
index 8ea831e1..ff2558c0 100644
--- a/src/components/NotificationRow.tsx
+++ b/src/components/NotificationRow.tsx
@@ -37,7 +37,7 @@ interface IProps {
 export const NotificationRow: FC<IProps> = ({ notification, hostname }) => {
   const {
     settings,
-    accounts,
+    auth: accounts,
     removeNotificationFromState,
     markNotificationRead,
     markNotificationDone,
diff --git a/src/context/App.tsx b/src/context/App.tsx
index fd7396af..2525c45d 100644
--- a/src/context/App.tsx
+++ b/src/context/App.tsx
@@ -47,7 +47,7 @@ export const defaultSettings: SettingsState = {
 };
 
 interface AppContextState {
-  accounts: AuthState;
+  auth: AuthState;
   isLoggedIn: boolean;
   login: () => void;
   loginEnterprise: (data: AuthOptions) => void;
@@ -136,7 +136,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
 
       const newSettings = { ...settings, [name]: value };
       setSettings(newSettings);
-      saveState(accounts, newSettings);
+      saveState({ auth: accounts, settings: newSettings });
     },
     [accounts, settings],
   );
@@ -152,7 +152,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
     const user = await getUserData(token, hostname);
     const updatedAccounts = addAccount(accounts, token, hostname, user);
     setAccounts(updatedAccounts);
-    saveState(updatedAccounts, settings);
+    saveState({ auth: updatedAccounts, settings });
   }, [accounts, settings]);
 
   const loginEnterprise = useCallback(
@@ -161,7 +161,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
       const { token, hostname } = await getToken(authCode, authOptions);
       const updatedAccounts = addAccount(accounts, token, hostname);
       setAccounts(updatedAccounts);
-      saveState(updatedAccounts, settings);
+      saveState({ auth: updatedAccounts, settings });
     },
     [accounts, settings],
   );
@@ -173,7 +173,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
       const user = await getUserData(token, hostname);
       const updatedAccounts = addAccount(accounts, token, hostname, user);
       setAccounts(updatedAccounts);
-      saveState(updatedAccounts, settings);
+      saveState({ auth: updatedAccounts, settings });
     },
     [accounts, settings],
   );
@@ -186,8 +186,8 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
   const restoreSettings = useCallback(() => {
     const existing = loadState();
 
-    if (existing.accounts) {
-      setAccounts({ ...defaultAccounts, ...existing.accounts });
+    if (existing.auth) {
+      setAccounts({ ...defaultAccounts, ...existing.auth });
     }
 
     if (existing.settings) {
@@ -234,7 +234,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
   return (
     <AppContext.Provider
       value={{
-        accounts,
+        auth: accounts,
         isLoggedIn,
         login,
         loginEnterprise,
diff --git a/src/routes/LoginWithOAuthApp.tsx b/src/routes/LoginWithOAuthApp.tsx
index 3f66d6eb..4620d266 100644
--- a/src/routes/LoginWithOAuthApp.tsx
+++ b/src/routes/LoginWithOAuthApp.tsx
@@ -58,7 +58,7 @@ export const validate = (values: IValues): IFormErrors => {
 
 export const LoginWithOAuthApp: FC = () => {
   const {
-    accounts: { enterpriseAccounts },
+    auth: { enterpriseAccounts },
     loginEnterprise,
   } = useContext(AppContext);
   const navigate = useNavigate();
diff --git a/src/routes/Settings.tsx b/src/routes/Settings.tsx
index 442e8251..7a0aec68 100644
--- a/src/routes/Settings.tsx
+++ b/src/routes/Settings.tsx
@@ -33,7 +33,12 @@ import {
 import { setTheme } from '../utils/theme';
 
 export const SettingsRoute: FC = () => {
-  const { accounts, settings, updateSetting, logout } = useContext(AppContext);
+  const {
+    auth: accounts,
+    settings,
+    updateSetting,
+    logout,
+  } = useContext(AppContext);
   const navigate = useNavigate();
 
   const [isLinux, setIsLinux] = useState<boolean>(false);
diff --git a/src/types.ts b/src/types.ts
index b4f663cd..b504dd7d 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -34,6 +34,11 @@ interface SystemSettingsState {
   showNotificationsCountInTray: boolean;
 }
 
+export interface GitifyState {
+  auth?: AuthState;
+  settings?: SettingsState;
+}
+
 export enum Theme {
   SYSTEM = 'SYSTEM',
   LIGHT = 'LIGHT',
diff --git a/src/utils/storage.ts b/src/utils/storage.ts
index 0f3332e3..74686be2 100644
--- a/src/utils/storage.ts
+++ b/src/utils/storage.ts
@@ -1,23 +1,19 @@
-import type { AuthState, SettingsState } from '../types';
+import type { GitifyState } from '../types';
 import { Constants } from './constants';
 
-export const loadState = (): {
-  accounts?: AuthState;
-  settings?: SettingsState;
-} => {
+export function loadState(): GitifyState {
   const existing = localStorage.getItem(Constants.STORAGE_KEY);
-  const { auth: accounts, settings } = (existing && JSON.parse(existing)) || {};
-  return { accounts, settings };
-};
+  const { auth, settings } = (existing && JSON.parse(existing)) || {};
+  return { auth, settings };
+}
 
-export const saveState = (
-  accounts: AuthState,
-  settings: SettingsState,
-): void => {
-  const settingsString = JSON.stringify({ auth: accounts, settings });
+export function saveState(gitifyState: GitifyState) {
+  const auth = gitifyState.auth;
+  const settings = gitifyState.settings;
+  const settingsString = JSON.stringify({ auth, settings });
   localStorage.setItem(Constants.STORAGE_KEY, settingsString);
-};
+}
 
-export const clearState = (): void => {
+export function clearState() {
   localStorage.clear();
-};
+}


Test patch:
diff --git a/src/components/NotificationRow.test.tsx b/src/components/NotificationRow.test.tsx
index 6657a9ba..7a2a0548 100644
--- a/src/components/NotificationRow.test.tsx
+++ b/src/components/NotificationRow.test.tsx
@@ -1,6 +1,6 @@
 import { fireEvent, render, screen } from '@testing-library/react';
 import { shell } from 'electron';
-import { mockAccounts, mockSettings } from '../__mocks__/state-mocks';
+import { mockAuth, mockSettings } from '../__mocks__/state-mocks';
 import { AppContext } from '../context/App';
 import type { UserType } from '../typesGitHub';
 import { mockSingleNotification } from '../utils/api/__mocks__/response-mocks';
@@ -131,7 +131,7 @@ describe('components/NotificationRow.tsx', () => {
           value={{
             settings: { ...mockSettings, markAsDoneOnOpen: false },
             removeNotificationFromState,
-            accounts: mockAccounts,
+            auth: mockAuth,
           }}
         >
           <NotificationRow {...props} />
@@ -156,7 +156,7 @@ describe('components/NotificationRow.tsx', () => {
           value={{
             settings: { ...mockSettings, markAsDoneOnOpen: false },
             removeNotificationFromState,
-            accounts: mockAccounts,
+            auth: mockAuth,
           }}
         >
           <NotificationRow {...props} />
@@ -181,7 +181,7 @@ describe('components/NotificationRow.tsx', () => {
           value={{
             settings: { ...mockSettings, markAsDoneOnOpen: true },
             markNotificationDone,
-            accounts: mockAccounts,
+            auth: mockAuth,
           }}
         >
           <NotificationRow {...props} />
@@ -205,7 +205,7 @@ describe('components/NotificationRow.tsx', () => {
         <AppContext.Provider
           value={{
             settings: { ...mockSettings, markAsDoneOnOpen: false },
-            accounts: mockAccounts,
+            auth: mockAuth,
           }}
         >
           <AppContext.Provider value={{ markNotificationRead }}>
@@ -230,7 +230,7 @@ describe('components/NotificationRow.tsx', () => {
         <AppContext.Provider
           value={{
             settings: { ...mockSettings },
-            accounts: mockAccounts,
+            auth: mockAuth,
           }}
         >
           <AppContext.Provider value={{ markNotificationDone }}>
@@ -285,7 +285,7 @@ describe('components/NotificationRow.tsx', () => {
         <AppContext.Provider
           value={{
             settings: { ...mockSettings },
-            accounts: mockAccounts,
+            auth: mockAuth,
           }}
         >
           <NotificationRow {...props} />
diff --git a/src/context/App.test.tsx b/src/context/App.test.tsx
index 0ab7083f..0409a4e7 100644
--- a/src/context/App.test.tsx
+++ b/src/context/App.test.tsx
@@ -1,7 +1,7 @@
 import { act, fireEvent, render, waitFor } from '@testing-library/react';
 import { useContext } from 'react';
 
-import { mockAccounts, mockSettings } from '../__mocks__/state-mocks';
+import { mockAuth, mockSettings } from '../__mocks__/state-mocks';
 import { useNotifications } from '../hooks/useNotifications';
 import type { AuthState, SettingsState } from '../types';
 import * as apiRequests from '../utils/api/request';
@@ -15,11 +15,11 @@ jest.mock('../hooks/useNotifications');
 
 const customRender = (
   ui,
-  accounts: AuthState = mockAccounts,
+  accounts: AuthState = mockAuth,
   settings: SettingsState = mockSettings,
 ) => {
   return render(
-    <AppContext.Provider value={{ accounts, settings }}>
+    <AppContext.Provider value={{ auth: accounts, settings }}>
       <AppProvider>{ui}</AppProvider>
     </AppContext.Provider>,
   );
@@ -320,9 +320,9 @@ describe('context/App.tsx', () => {
       fireEvent.click(getByText('Test Case'));
     });
 
-    expect(saveStateMock).toHaveBeenCalledWith(
-      { enterpriseAccounts: [], token: null, user: null },
-      {
+    expect(saveStateMock).toHaveBeenCalledWith({
+      auth: { enterpriseAccounts: [], token: null, user: null },
+      settings: {
         participating: true,
         playSound: true,
         showNotifications: true,
@@ -335,7 +335,7 @@ describe('context/App.tsx', () => {
         showAccountHostname: false,
         delayNotificationState: false,
       },
-    );
+    });
   });
 
   it('should call updateSetting and set auto launch(openAtStartup)', async () => {
@@ -365,9 +365,9 @@ describe('context/App.tsx', () => {
 
     expect(setAutoLaunchMock).toHaveBeenCalledWith(true);
 
-    expect(saveStateMock).toHaveBeenCalledWith(
-      { enterpriseAccounts: [], token: null, user: null },
-      {
+    expect(saveStateMock).toHaveBeenCalledWith({
+      auth: { enterpriseAccounts: [], token: null, user: null },
+      settings: {
         participating: false,
         playSound: true,
         showNotifications: true,
@@ -380,6 +380,6 @@ describe('context/App.tsx', () => {
         showAccountHostname: false,
         delayNotificationState: false,
       },
-    );
+    });
   });
 });
diff --git a/src/hooks/useNotifications.test.ts b/src/hooks/useNotifications.test.ts
index 95a9b44e..7ef8bf27 100644
--- a/src/hooks/useNotifications.test.ts
+++ b/src/hooks/useNotifications.test.ts
@@ -2,7 +2,7 @@ import { act, renderHook, waitFor } from '@testing-library/react';
 import axios, { AxiosError } from 'axios';
 import nock from 'nock';
 
-import { mockAccounts, mockSettings, mockUser } from '../__mocks__/state-mocks';
+import { mockAuth, mockSettings, mockUser } from '../__mocks__/state-mocks';
 import type { AuthState } from '../types';
 import { mockNotificationUser } from '../utils/api/__mocks__/response-mocks';
 import { Errors } from '../utils/constants';
@@ -34,7 +34,7 @@ describe('hooks/useNotifications.ts', () => {
         const { result } = renderHook(() => useNotifications());
 
         act(() => {
-          result.current.fetchNotifications(mockAccounts, {
+          result.current.fetchNotifications(mockAuth, {
             ...mockSettings,
             detailedNotifications: false,
           });
@@ -87,7 +87,7 @@ describe('hooks/useNotifications.ts', () => {
         const { result } = renderHook(() => useNotifications());
 
         act(() => {
-          result.current.fetchNotifications(mockAccounts, mockSettings);
+          result.current.fetchNotifications(mockAuth, mockSettings);
         });
 
         expect(result.current.status).toBe('loading');
@@ -103,7 +103,7 @@ describe('hooks/useNotifications.ts', () => {
     describe('enterprise', () => {
       it('should fetch notifications with success - enterprise only', async () => {
         const accounts: AuthState = {
-          ...mockAccounts,
+          ...mockAuth,
           token: null,
         };
 
@@ -137,7 +137,7 @@ describe('hooks/useNotifications.ts', () => {
 
       it('should fetch notifications with failure - enterprise only', async () => {
         const accounts: AuthState = {
-          ...mockAccounts,
+          ...mockAuth,
           token: null,
         };
 
@@ -168,7 +168,7 @@ describe('hooks/useNotifications.ts', () => {
     describe('github.com', () => {
       it('should fetch notifications with success - github.com only', async () => {
         const accounts: AuthState = {
-          ...mockAccounts,
+          ...mockAuth,
           enterpriseAccounts: [],
           user: mockUser,
         };
@@ -201,7 +201,7 @@ describe('hooks/useNotifications.ts', () => {
 
       it('should fetch notifications with failures - github.com only', async () => {
         const accounts: AuthState = {
-          ...mockAccounts,
+          ...mockAuth,
           enterpriseAccounts: [],
         };
 
@@ -233,7 +233,7 @@ describe('hooks/useNotifications.ts', () => {
     describe('with detailed notifications', () => {
       it('should fetch notifications with success', async () => {
         const accounts: AuthState = {
-          ...mockAccounts,
+          ...mockAuth,
           enterpriseAccounts: [],
           user: mockUser,
         };
@@ -429,7 +429,7 @@ describe('hooks/useNotifications.ts', () => {
       const { result } = renderHook(() => useNotifications());
 
       act(() => {
-        result.current.fetchNotifications(mockAccounts, {
+        result.current.fetchNotifications(mockAuth, {
           ...mockSettings,
           detailedNotifications: false,
         });
@@ -455,7 +455,7 @@ describe('hooks/useNotifications.ts', () => {
     const id = 'notification-123';
 
     describe('github.com', () => {
-      const accounts = { ...mockAccounts, enterpriseAccounts: [] };
+      const accounts = { ...mockAuth, enterpriseAccounts: [] };
       const hostname = 'github.com';
 
       it('should mark a notification as read with success - github.com', async () => {
@@ -506,7 +506,7 @@ describe('hooks/useNotifications.ts', () => {
     });
 
     describe('enterprise', () => {
-      const accounts = { ...mockAccounts, token: null };
+      const accounts = { ...mockAuth, token: null };
       const hostname = 'github.gitify.io';
 
       it('should mark a notification as read with success - enterprise', async () => {
@@ -561,7 +561,7 @@ describe('hooks/useNotifications.ts', () => {
     const id = 'notification-123';
 
     describe('github.com', () => {
-      const accounts = { ...mockAccounts, enterpriseAccounts: [] };
+      const accounts = { ...mockAuth, enterpriseAccounts: [] };
       const hostname = 'github.com';
 
       it('should mark a notification as done with success - github.com', async () => {
@@ -612,7 +612,7 @@ describe('hooks/useNotifications.ts', () => {
     });
 
     describe('enterprise', () => {
-      const accounts = { ...mockAccounts, token: null };
+      const accounts = { ...mockAuth, token: null };
       const hostname = 'github.gitify.io';
 
       it('should mark a notification as done with success - enterprise', async () => {
@@ -667,7 +667,7 @@ describe('hooks/useNotifications.ts', () => {
     const id = 'notification-123';
 
     describe('github.com', () => {
-      const accounts = { ...mockAccounts, enterpriseAccounts: [] };
+      const accounts = { ...mockAuth, enterpriseAccounts: [] };
       const hostname = 'github.com';
 
       it('should unsubscribe from a notification with success - github.com', async () => {
@@ -730,7 +730,7 @@ describe('hooks/useNotifications.ts', () => {
     });
 
     describe('enterprise', () => {
-      const accounts = { ...mockAccounts, token: null };
+      const accounts = { ...mockAuth, token: null };
       const hostname = 'github.gitify.io';
 
       it('should unsubscribe from a notification with success - enterprise', async () => {
@@ -797,7 +797,7 @@ describe('hooks/useNotifications.ts', () => {
     const repoSlug = 'gitify-app/notifications-test';
 
     describe('github.com', () => {
-      const accounts = { ...mockAccounts, enterpriseAccounts: [] };
+      const accounts = { ...mockAuth, enterpriseAccounts: [] };
       const hostname = 'github.com';
 
       it("should mark a repository's notifications as read with success - github.com", async () => {
@@ -848,7 +848,7 @@ describe('hooks/useNotifications.ts', () => {
     });
 
     describe('enterprise', () => {
-      const accounts = { ...mockAccounts, token: null };
+      const accounts = { ...mockAuth, token: null };
       const hostname = 'github.gitify.io';
 
       it("should mark a repository's notifications as read with success - enterprise", async () => {
@@ -904,7 +904,7 @@ describe('hooks/useNotifications.ts', () => {
     const id = 'notification-123';
 
     describe('github.com', () => {
-      const accounts = { ...mockAccounts, enterpriseAccounts: [] };
+      const accounts = { ...mockAuth, enterpriseAccounts: [] };
       const hostname = 'github.com';
 
       it("should mark a repository's notifications as done with success - github.com", async () => {
@@ -955,7 +955,7 @@ describe('hooks/useNotifications.ts', () => {
     });
 
     describe('enterprise', () => {
-      const accounts = { ...mockAccounts, token: null };
+      const accounts = { ...mockAuth, token: null };
       const hostname = 'github.gitify.io';
 
       it("should mark a repository's notifications as done with success - enterprise", async () => {
diff --git a/src/routes/LoginWithOAuthApp.test.tsx b/src/routes/LoginWithOAuthApp.test.tsx
index 3a34c277..f42d61c6 100644
--- a/src/routes/LoginWithOAuthApp.test.tsx
+++ b/src/routes/LoginWithOAuthApp.test.tsx
@@ -1,6 +1,5 @@
 import { fireEvent, render, screen } from '@testing-library/react';
-import { ipcRenderer } from 'electron';
-import { shell } from 'electron';
+import { ipcRenderer, shell } from 'electron';
 import { MemoryRouter } from 'react-router-dom';
 import { mockEnterpriseAccounts } from '../__mocks__/state-mocks';
 import { AppContext } from '../context/App';
@@ -30,7 +29,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
 
   it('renders correctly', () => {
     const tree = render(
-      <AppContext.Provider value={{ accounts: mockAccounts }}>
+      <AppContext.Provider value={{ auth: mockAccounts }}>
         <MemoryRouter>
           <LoginWithOAuthApp />
         </MemoryRouter>
@@ -42,7 +41,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
 
   it('let us go back', () => {
     render(
-      <AppContext.Provider value={{ accounts: mockAccounts }}>
+      <AppContext.Provider value={{ auth: mockAccounts }}>
         <MemoryRouter>
           <LoginWithOAuthApp />
         </MemoryRouter>
@@ -81,7 +80,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
   describe("'Create new OAuth App' button", () => {
     it('should be disabled if no hostname configured', async () => {
       render(
-        <AppContext.Provider value={{ accounts: mockAccounts }}>
+        <AppContext.Provider value={{ auth: mockAccounts }}>
           <MemoryRouter>
             <LoginWithOAuthApp />
           </MemoryRouter>
@@ -95,7 +94,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
 
     it('should open in browser if hostname configured', async () => {
       render(
-        <AppContext.Provider value={{ accounts: mockAccounts }}>
+        <AppContext.Provider value={{ auth: mockAccounts }}>
           <MemoryRouter>
             <LoginWithOAuthApp />
           </MemoryRouter>
@@ -114,7 +113,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
 
   it('should receive a logged-in enterprise account', () => {
     const { rerender } = render(
-      <AppContext.Provider value={{ accounts: mockAccounts }}>
+      <AppContext.Provider value={{ auth: mockAccounts }}>
         <MemoryRouter>
           <LoginWithOAuthApp />
         </MemoryRouter>
@@ -124,7 +123,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
     rerender(
       <AppContext.Provider
         value={{
-          accounts: {
+          auth: {
             enterpriseAccounts: mockEnterpriseAccounts,
             user: null,
           },
@@ -143,7 +142,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
 
   it('should render the form with errors', () => {
     render(
-      <AppContext.Provider value={{ accounts: mockAccounts }}>
+      <AppContext.Provider value={{ auth: mockAccounts }}>
         <MemoryRouter>
           <LoginWithOAuthApp />
         </MemoryRouter>
@@ -169,7 +168,7 @@ describe('routes/LoginWithOAuthApp.tsx', () => {
 
   it('should open help docs in the browser', async () => {
     render(
-      <AppContext.Provider value={{ accounts: mockAccounts }}>
+      <AppContext.Provider value={{ auth: mockAccounts }}>
         <MemoryRouter>
           <LoginWithOAuthApp />
         </MemoryRouter>
diff --git a/src/routes/Settings.test.tsx b/src/routes/Settings.test.tsx
index 5049dd3e..ce3d69a5 100644
--- a/src/routes/Settings.test.tsx
+++ b/src/routes/Settings.test.tsx
@@ -1,7 +1,7 @@
 import { act, fireEvent, render, screen } from '@testing-library/react';
 import { ipcRenderer, shell } from 'electron';
 import { MemoryRouter } from 'react-router-dom';
-import { mockAccounts, mockSettings } from '../__mocks__/state-mocks';
+import { mockAuth, mockSettings } from '../__mocks__/state-mocks';
 import { AppContext } from '../context/App';
 import { SettingsRoute } from './Settings';
 
@@ -23,7 +23,7 @@ describe('routes/Settings.tsx', () => {
       await act(async () => {
         render(
           <AppContext.Provider
-            value={{ settings: mockSettings, accounts: mockAccounts }}
+            value={{ settings: mockSettings, auth: mockAuth }}
           >
             <MemoryRouter>
               <SettingsRoute />
@@ -41,7 +41,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
             }}
           >
             <MemoryRouter>
@@ -62,7 +62,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -85,7 +85,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -115,7 +115,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -140,7 +140,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -179,7 +179,7 @@ describe('routes/Settings.tsx', () => {
                 detailedNotifications: false,
                 showBots: true,
               },
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -220,7 +220,7 @@ describe('routes/Settings.tsx', () => {
                 detailedNotifications: true,
                 showBots: true,
               },
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -257,7 +257,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -282,7 +282,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -312,7 +312,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -343,7 +343,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -368,7 +368,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -393,7 +393,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               updateSetting,
             }}
           >
@@ -420,7 +420,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
             }}
           >
             <MemoryRouter>
@@ -445,7 +445,7 @@ describe('routes/Settings.tsx', () => {
             <AppContext.Provider
               value={{
                 settings: mockSettings,
-                accounts: { ...mockAccounts, token: null },
+                auth: { ...mockAuth, token: null },
               }}
             >
               <MemoryRouter>
@@ -475,7 +475,7 @@ describe('routes/Settings.tsx', () => {
             <AppContext.Provider
               value={{
                 settings: mockSettings,
-                accounts: { ...mockAccounts, token: '1234' },
+                auth: { ...mockAuth, token: '1234' },
               }}
             >
               <MemoryRouter>
@@ -498,8 +498,8 @@ describe('routes/Settings.tsx', () => {
             <AppContext.Provider
               value={{
                 settings: mockSettings,
-                accounts: {
-                  ...mockAccounts,
+                auth: {
+                  ...mockAuth,
                   enterpriseAccounts: [],
                 },
               }}
@@ -525,7 +525,7 @@ describe('routes/Settings.tsx', () => {
             <AppContext.Provider
               value={{
                 settings: mockSettings,
-                accounts: mockAccounts,
+                auth: mockAuth,
               }}
             >
               <MemoryRouter>
@@ -546,7 +546,7 @@ describe('routes/Settings.tsx', () => {
           <AppContext.Provider
             value={{
               settings: mockSettings,
-              accounts: mockAccounts,
+              auth: mockAuth,
               logout: logoutMock,
             }}
           >
@@ -571,7 +571,7 @@ describe('routes/Settings.tsx', () => {
       await act(async () => {
         render(
           <AppContext.Provider
-            value={{ settings: mockSettings, accounts: mockAccounts }}
+            value={{ settings: mockSettings, auth: mockAuth }}
           >
             <MemoryRouter>
               <SettingsRoute />
diff --git a/src/utils/helpers.test.ts b/src/utils/helpers.test.ts
index 53333008..42bd831c 100644
--- a/src/utils/helpers.test.ts
+++ b/src/utils/helpers.test.ts
@@ -1,5 +1,5 @@
 import type { AxiosPromise, AxiosResponse } from 'axios';
-import { mockAccounts, mockUser } from '../__mocks__/state-mocks';
+import { mockAuth, mockUser } from '../__mocks__/state-mocks';
 import type { SubjectType } from '../typesGitHub';
 import {
   mockGraphQLResponse,
@@ -19,14 +19,14 @@ describe('utils/helpers.ts', () => {
   describe('isPersonalAccessTokenLoggedIn', () => {
     it('logged in', () => {
       expect(
-        isPersonalAccessTokenLoggedIn({ ...mockAccounts, token: '1234' }),
+        isPersonalAccessTokenLoggedIn({ ...mockAuth, token: '1234' }),
       ).toBe(true);
     });
 
     it('logged out', () => {
-      expect(
-        isPersonalAccessTokenLoggedIn({ ...mockAccounts, token: null }),
-      ).toBe(false);
+      expect(isPersonalAccessTokenLoggedIn({ ...mockAuth, token: null })).toBe(
+        false,
+      );
     });
   });
 
@@ -34,7 +34,7 @@ describe('utils/helpers.ts', () => {
     it('logged in', () => {
       expect(
         isOAuthAppLoggedIn({
-          ...mockAccounts,
+          ...mockAuth,
           enterpriseAccounts: [{ hostname: 'github.gitify.io', token: '1234' }],
         }),
       ).toBe(true);
@@ -42,12 +42,12 @@ describe('utils/helpers.ts', () => {
 
     it('logged out', () => {
       expect(
-        isOAuthAppLoggedIn({ ...mockAccounts, enterpriseAccounts: null }),
+        isOAuthAppLoggedIn({ ...mockAuth, enterpriseAccounts: null }),
       ).toBe(false);
 
-      expect(
-        isOAuthAppLoggedIn({ ...mockAccounts, enterpriseAccounts: [] }),
-      ).toBe(false);
+      expect(isOAuthAppLoggedIn({ ...mockAuth, enterpriseAccounts: [] })).toBe(
+        false,
+      );
     });
   });
 
@@ -110,14 +110,14 @@ describe('utils/helpers.ts', () => {
           ...mockSingleNotification,
           subject: subject,
         },
-        mockAccounts,
+        mockAuth,
       );
 
       expect(apiRequestAuthMock).toHaveBeenCalledTimes(1);
       expect(apiRequestAuthMock).toHaveBeenCalledWith(
         subject.latest_comment_url,
         'GET',
-        mockAccounts.token,
+        mockAuth.token,
       );
       expect(result).toBe(`${mockHtmlUrl}?${mockNotificationReferrer}`);
     });
@@ -145,14 +145,14 @@ describe('utils/helpers.ts', () => {
           ...mockSingleNotification,
           subject: subject,
         },
-        mockAccounts,
+        mockAuth,
       );
 
       expect(apiRequestAuthMock).toHaveBeenCalledTimes(1);
       expect(apiRequestAuthMock).toHaveBeenCalledWith(
         subject.url,
         'GET',
-        mockAccounts.token,
+        mockAuth.token,
       );
       expect(result).toBe(`${mockHtmlUrl}?${mockNotificationReferrer}`);
     });
@@ -171,7 +171,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -193,7 +193,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -215,7 +215,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -237,7 +237,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -259,7 +259,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -281,7 +281,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -303,7 +303,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -335,7 +335,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(1);
@@ -367,7 +367,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(1);
@@ -395,7 +395,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(1);
@@ -419,7 +419,7 @@ describe('utils/helpers.ts', () => {
           ...mockSingleNotification,
           subject: subject,
         },
-        mockAccounts,
+        mockAuth,
       );
 
       expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -442,7 +442,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -465,7 +465,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -487,7 +487,7 @@ describe('utils/helpers.ts', () => {
             ...mockSingleNotification,
             subject: subject,
           },
-          mockAccounts,
+          mockAuth,
         );
 
         expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
@@ -510,7 +510,7 @@ describe('utils/helpers.ts', () => {
           ...mockSingleNotification,
           subject: subject,
         },
-        mockAccounts,
+        mockAuth,
       );
 
       expect(apiRequestAuthMock).toHaveBeenCalledTimes(0);
diff --git a/src/utils/notifications.test.ts b/src/utils/notifications.test.ts
index 6488677b..d8c03630 100644
--- a/src/utils/notifications.test.ts
+++ b/src/utils/notifications.test.ts
@@ -5,7 +5,7 @@ import {
   mockSingleAccountNotifications,
 } from '../__mocks__/notifications-mocks';
 import { partialMockNotification } from '../__mocks__/partial-mocks';
-import { mockAccounts, mockSettings } from '../__mocks__/state-mocks';
+import { mockAuth, mockSettings } from '../__mocks__/state-mocks';
 import { defaultSettings } from '../context/App';
 import type { SettingsState } from '../types';
 import {
@@ -35,7 +35,7 @@ describe('utils/notifications.ts', () => {
       [],
       mockAccountNotifications,
       settings,
-      mockAccounts,
+      mockAuth,
     );
 
     expect(notificationsHelpers.raiseNativeNotification).toHaveBeenCalledTimes(
@@ -60,7 +60,7 @@ describe('utils/notifications.ts', () => {
       [],
       mockAccountNotifications,
       settings,
-      mockAccounts,
+      mockAuth,
     );
 
     expect(notificationsHelpers.raiseNativeNotification).not.toHaveBeenCalled();
@@ -81,7 +81,7 @@ describe('utils/notifications.ts', () => {
       mockSingleAccountNotifications,
       mockSingleAccountNotifications,
       settings,
-      mockAccounts,
+      mockAuth,
     );
 
     expect(notificationsHelpers.raiseNativeNotification).not.toHaveBeenCalled();
@@ -98,12 +98,7 @@ describe('utils/notifications.ts', () => {
     jest.spyOn(notificationsHelpers, 'raiseNativeNotification');
     jest.spyOn(notificationsHelpers, 'raiseSoundNotification');
 
-    notificationsHelpers.triggerNativeNotifications(
-      [],
-      [],
-      settings,
-      mockAccounts,
-    );
+    notificationsHelpers.triggerNativeNotifications([], [], settings, mockAuth);
 
     expect(notificationsHelpers.raiseNativeNotification).not.toHaveBeenCalled();
     expect(notificationsHelpers.raiseSoundNotification).not.toHaveBeenCalled();
@@ -115,14 +110,14 @@ describe('utils/notifications.ts', () => {
     const nativeNotification: Notification =
       notificationsHelpers.raiseNativeNotification(
         [mockSingleNotification],
-        mockAccounts,
+        mockAuth,
       );
     nativeNotification.onclick(null);
 
     expect(helpers.openInBrowser).toHaveBeenCalledTimes(1);
     expect(helpers.openInBrowser).toHaveBeenLastCalledWith(
       mockSingleNotification,
-      mockAccounts,
+      mockAuth,
     );
     expect(ipcRenderer.send).toHaveBeenCalledWith('hide-window');
   });
@@ -130,7 +125,7 @@ describe('utils/notifications.ts', () => {
   it('should click on a native notification (with more than 1 notification)', () => {
     const nativeNotification = notificationsHelpers.raiseNativeNotification(
       mockGitHubNotifications,
-      mockAccounts,
+      mockAuth,
     );
     nativeNotification.onclick(null);
 
diff --git a/src/utils/storage.test.ts b/src/utils/storage.test.ts
index 37fdafc6..f4cf81cf 100644
--- a/src/utils/storage.test.ts
+++ b/src/utils/storage.test.ts
@@ -10,7 +10,7 @@ describe('utils/storage.ts', () => {
       }),
     );
     const result = loadState();
-    expect(result.accounts.token).toBe('123-456');
+    expect(result.auth.token).toBe('123-456');
     expect(result.settings.theme).toBe('DARK');
   });
 
@@ -19,20 +19,20 @@ describe('utils/storage.ts', () => {
       .spyOn(localStorage.__proto__, 'getItem')
       .mockReturnValueOnce(JSON.stringify({}));
     const result = loadState();
-    expect(result.accounts).toBeUndefined();
+    expect(result.auth).toBeUndefined();
     expect(result.settings).toBeUndefined();
   });
 
   it('should save the state to localstorage', () => {
     jest.spyOn(localStorage.__proto__, 'setItem');
-    saveState(
-      {
+    saveState({
+      auth: {
         token: '123-456',
         enterpriseAccounts: [],
         user: null,
       },
-      mockSettings,
-    );
+      settings: mockSettings,
+    });
     expect(localStorage.setItem).toHaveBeenCalledTimes(1);
   });
 
diff --git a/src/utils/subject.test.ts b/src/utils/subject.test.ts
index 4864732d..df893078 100644
--- a/src/utils/subject.test.ts
+++ b/src/utils/subject.test.ts
@@ -5,7 +5,7 @@ import {
   partialMockNotification,
   partialMockUser,
 } from '../__mocks__/partial-mocks';
-import { mockAccounts } from '../__mocks__/state-mocks';
+import { mockAuth } from '../__mocks__/state-mocks';
 import type {
   Discussion,
   DiscussionAuthor,
@@ -46,7 +46,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -63,7 +63,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -80,7 +80,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -97,7 +97,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -114,7 +114,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -131,7 +131,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toBeNull();
@@ -145,7 +145,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toBeNull();
@@ -173,7 +173,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -203,7 +203,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -245,7 +245,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -273,7 +273,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -301,7 +301,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -329,7 +329,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -357,7 +357,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -385,7 +385,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -424,7 +424,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -449,7 +449,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -478,7 +478,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -507,7 +507,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -536,7 +536,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -564,7 +564,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -612,7 +612,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -647,7 +647,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -682,7 +682,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -717,7 +717,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -751,7 +751,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -784,7 +784,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -832,7 +832,7 @@ describe('utils/subject.ts', () => {
 
           const result = await getLatestReviewForReviewers(
             mockNotification,
-            mockAccounts.token,
+            mockAuth.token,
           );
 
           expect(result).toEqual([
@@ -848,7 +848,7 @@ describe('utils/subject.ts', () => {
 
           const result = await getLatestReviewForReviewers(
             mockNotification,
-            mockAccounts.token,
+            mockAuth.token,
           );
 
           expect(result).toBeNull();
@@ -859,7 +859,7 @@ describe('utils/subject.ts', () => {
 
           const result = await getLatestReviewForReviewers(
             mockNotification,
-            mockAccounts.token,
+            mockAuth.token,
           );
 
           expect(result).toBeNull();
@@ -883,7 +883,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -907,7 +907,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toEqual({
@@ -925,7 +925,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toBeNull();
@@ -939,7 +939,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toBeNull();
@@ -956,7 +956,7 @@ describe('utils/subject.ts', () => {
 
         const result = await getGitifySubjectDetails(
           mockNotification,
-          mockAccounts.token,
+          mockAuth.token,
         );
 
         expect(result).toBeNull();
@@ -980,7 +980,7 @@ describe('utils/subject.ts', () => {
           .get('/repos/gitify-app/notifications-test/issues/1')
           .replyWithError(mockError);
 
-        await getGitifySubjectDetails(mockNotification, mockAccounts.token);
+        await getGitifySubjectDetails(mockNotification, mockAuth.token);
 
         expect(consoleErrorSpy).toHaveBeenCalledWith(
           'Error occurred while fetching details for Issue notification: This issue will throw an error',