From de87f0cf5ba9cf51b17bb26d81c67f54ad732e75 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 16 Nov 2025 15:20:49 -0500 Subject: [PATCH 01/17] test: refactor render with app context Signed-off-by: Adam Setch --- src/renderer/__helpers__/test-utils.tsx | 140 + src/renderer/components/AllRead.test.tsx | 40 +- src/renderer/components/Oops.test.tsx | 11 +- src/renderer/components/Sidebar.test.tsx | 262 +- .../__snapshots__/AllRead.test.tsx.snap | 276 +- .../__snapshots__/Oops.test.tsx.snap | 316 +- .../__snapshots__/Sidebar.test.tsx.snap | 1936 ++--- .../avatars/AvatarWithFallback.test.tsx | 17 +- .../AvatarWithFallback.test.tsx.snap | 500 +- .../components/fields/Checkbox.test.tsx | 21 +- .../components/fields/FieldLabel.test.tsx | 5 +- .../components/fields/RadioGroup.test.tsx | 7 +- .../components/fields/Tooltip.test.tsx | 38 +- .../__snapshots__/Checkbox.test.tsx.snap | 770 +- .../__snapshots__/FieldLabel.test.tsx.snap | 42 +- .../__snapshots__/RadioGroup.test.tsx.snap | 492 +- .../components/filters/FilterSection.test.tsx | 126 +- .../components/filters/ReasonFilter.test.tsx | 18 +- ...uiresDetailedNotificationsWarning.test.tsx | 18 +- .../components/filters/SearchFilter.test.tsx | 72 +- .../filters/SearchFilterSuggestions.test.tsx | 74 +- .../components/filters/StateFilter.test.tsx | 23 +- .../filters/SubjectTypeFilter.test.tsx | 21 +- .../filters/UserTypeFilter.test.tsx | 23 +- .../__snapshots__/FilterSection.test.tsx.snap | 2012 ++--- .../__snapshots__/ReasonFilter.test.tsx.snap | 3352 ++++---- ...DetailedNotificationsWarning.test.tsx.snap | 62 +- .../SearchFilterSuggestions.test.tsx.snap | 846 +- .../__snapshots__/StateFilter.test.tsx.snap | 1106 +-- .../SubjectTypeFilter.test.tsx.snap | 1330 +-- .../UserTypeFilter.test.tsx.snap | 682 +- .../components/icons/LogoIcon.test.tsx | 15 +- .../__snapshots__/LogoIcon.test.tsx.snap | 930 ++- .../components/layout/AppLayout.test.tsx | 20 +- .../components/layout/Centered.test.tsx | 11 +- .../components/layout/Contents.test.tsx | 5 +- .../components/layout/EmojiSplash.test.tsx | 13 +- src/renderer/components/layout/Page.test.tsx | 5 +- .../__snapshots__/Centered.test.tsx.snap | 100 +- .../__snapshots__/Contents.test.tsx.snap | 30 +- .../__snapshots__/EmojiSplash.test.tsx.snap | 296 +- .../layout/__snapshots__/Page.test.tsx.snap | 34 +- .../components/metrics/MetricGroup.test.tsx | 163 +- .../components/metrics/MetricPill.test.tsx | 7 +- .../__snapshots__/MetricGroup.test.tsx.snap | 5070 ++++++------ .../__snapshots__/MetricPill.test.tsx.snap | 280 +- .../AccountNotifications.test.tsx | 135 +- .../notifications/NotificationFooter.test.tsx | 63 +- .../notifications/NotificationHeader.test.tsx | 84 +- .../notifications/NotificationRow.test.tsx | 140 +- .../RepositoryNotifications.test.tsx | 63 +- .../AccountNotifications.test.tsx.snap | 7211 +++++++++-------- .../NotificationFooter.test.tsx.snap | 2194 ++--- .../NotificationHeader.test.tsx.snap | 500 +- .../NotificationRow.test.tsx.snap | 4540 ++++++----- .../RepositoryNotifications.test.tsx.snap | 3157 ++++---- .../primitives/CustomCounter.test.tsx | 5 +- .../components/primitives/EmojiText.test.tsx | 7 +- .../components/primitives/Footer.test.tsx | 9 +- .../components/primitives/Header.test.tsx | 28 +- .../primitives/HoverButton.test.tsx | 7 +- .../components/primitives/HoverGroup.test.tsx | 5 +- .../components/primitives/Title.test.tsx | 9 +- .../__snapshots__/CustomCounter.test.tsx.snap | 38 +- .../__snapshots__/EmojiText.test.tsx.snap | 50 +- .../__snapshots__/Footer.test.tsx.snap | 108 +- .../__snapshots__/Header.test.tsx.snap | 238 +- .../__snapshots__/HoverButton.test.tsx.snap | 160 +- .../__snapshots__/HoverGroup.test.tsx.snap | 54 +- .../__snapshots__/Title.test.tsx.snap | 158 +- .../settings/AppearanceSettings.test.tsx | 112 +- .../settings/NotificationSettings.test.tsx | 252 +- .../settings/SettingsFooter.test.tsx | 49 +- .../settings/SettingsReset.test.tsx | 34 +- .../settings/SystemSettings.test.tsx | 157 +- .../components/settings/TraySettings.test.tsx | 52 +- .../SettingsFooter.test.tsx.snap | 2 +- src/renderer/context/App.test.tsx | 73 +- src/renderer/context/App.tsx | 2 +- src/renderer/routes/Accounts.test.tsx | 264 +- src/renderer/routes/Filters.test.tsx | 59 +- src/renderer/routes/Login.test.tsx | 31 +- .../routes/LoginWithOAuthApp.test.tsx | 61 +- .../LoginWithPersonalAccessToken.test.tsx | 70 +- src/renderer/routes/Notifications.test.tsx | 121 +- src/renderer/routes/Settings.test.tsx | 25 +- .../__snapshots__/Accounts.test.tsx.snap | 3697 --------- .../__snapshots__/Filters.test.tsx.snap | 6 +- .../routes/__snapshots__/Login.test.tsx.snap | 814 +- .../LoginWithOAuthApp.test.tsx.snap | 1520 ++-- ...LoginWithPersonalAccessToken.test.tsx.snap | 1368 ++-- .../__snapshots__/Notifications.test.tsx.snap | 272 +- .../__snapshots__/Settings.test.tsx.snap | 40 +- 93 files changed, 23668 insertions(+), 25993 deletions(-) create mode 100644 src/renderer/__helpers__/test-utils.tsx delete mode 100644 src/renderer/routes/__snapshots__/Accounts.test.tsx.snap diff --git a/src/renderer/__helpers__/test-utils.tsx b/src/renderer/__helpers__/test-utils.tsx new file mode 100644 index 000000000..1fdc1cbca --- /dev/null +++ b/src/renderer/__helpers__/test-utils.tsx @@ -0,0 +1,140 @@ +import type { RenderOptions } from '@testing-library/react'; +import { render } from '@testing-library/react'; +import type { ReactElement, ReactNode } from 'react'; +import { useMemo } from 'react'; + +import { BaseStyles, ThemeProvider } from '@primer/react'; + +import { mockAuth, mockSettings } from '../__mocks__/state-mocks'; +import type { AppContextState } from '../context/App'; +import { AppContext } from '../context/App'; + +/** + * Props for the AppContextProvider wrapper + */ +interface AppContextProviderProps { + readonly children: ReactNode; + readonly value?: Partial; +} + +/** + * Wrapper component that provides ThemeProvider, BaseStyles, and AppContext + * with sensible defaults for testing. + */ +export function AppContextProvider({ + children, + value = {}, +}: AppContextProviderProps) { + const defaultValue: Partial = useMemo(() => { + return { + auth: mockAuth, + isLoggedIn: false, + loginWithGitHubApp: async () => {}, + loginWithOAuthApp: async () => {}, + loginWithPersonalAccessToken: async () => {}, + logoutFromAccount: async () => {}, + + status: 'success', + globalError: { title: '', descriptions: [], emojis: [] }, + + notifications: [], + notificationCount: 0, + unreadNotificationCount: 0, + hasNotifications: false, + hasUnreadNotifications: false, + + fetchNotifications: async () => {}, + removeAccountNotifications: async () => {}, + + markNotificationsAsRead: async () => {}, + markNotificationsAsDone: async () => {}, + unsubscribeNotification: async () => {}, + + settings: mockSettings, + clearFilters: () => {}, + resetSettings: () => {}, + updateSetting: () => {}, + updateFilter: () => {}, + + ...value, + } as Partial; + }, [value]); + + return ( + + + + {children} + + + + ); +} + +/** + * Custom render function that wraps components with AppContextProvider by default. + * + * Usage (simplified): + * renderWithAppContext(, { auth, settings }) + * + * Legacy (still supported): + * renderWithAppContext(, { appContext: { auth, settings } }) + */ +type RenderWithAppContextOptions = Omit & + Partial & { + appContext?: Partial; + }; + +export function renderWithAppContext( + ui: ReactElement, + options: RenderWithAppContextOptions = {}, +) { + const CONTEXT_KEYS: Array = [ + 'auth', + 'isLoggedIn', + 'loginWithGitHubApp', + 'loginWithOAuthApp', + 'loginWithPersonalAccessToken', + 'logoutFromAccount', + 'status', + 'globalError', + 'notifications', + 'notificationCount', + 'unreadNotificationCount', + 'hasNotifications', + 'hasUnreadNotifications', + 'fetchNotifications', + 'removeAccountNotifications', + 'markNotificationsAsRead', + 'markNotificationsAsDone', + 'unsubscribeNotification', + 'settings', + 'clearFilters', + 'resetSettings', + 'updateSetting', + 'updateFilter', + ]; + + const { appContext, ...rest } = options as Partial> & { + appContext?: Partial; + }; + + const ctxFromTopLevel: Partial = {}; + for (const key of CONTEXT_KEYS) { + if (key in rest && rest[key] !== undefined) { + (ctxFromTopLevel as Partial>)[key] = rest[key]; + } + } + + const value: Partial = { ...ctxFromTopLevel }; + if (appContext) { + Object.assign(value, appContext); + } + + return render(ui, { + wrapper: ({ children }) => ( + {children} + ), + // No additional render options by default + }); +} diff --git a/src/renderer/components/AllRead.test.tsx b/src/renderer/components/AllRead.test.tsx index 743e4d6cf..30380ac74 100644 --- a/src/renderer/components/AllRead.test.tsx +++ b/src/renderer/components/AllRead.test.tsx @@ -1,8 +1,8 @@ -import { act, render } from '@testing-library/react'; +import { act } from '@testing-library/react'; +import { renderWithAppContext } from '../__helpers__/test-utils'; import { mockSettings } from '../__mocks__/state-mocks'; import { ensureStableEmojis } from '../__mocks__/utils'; -import { AppContext } from '../context/App'; import { AllRead } from './AllRead'; describe('renderer/components/AllRead.tsx', () => { @@ -11,41 +11,27 @@ describe('renderer/components/AllRead.tsx', () => { }); it('should render itself & its children - no filters', async () => { - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { - tree = render( - - - , - ); + tree = renderWithAppContext(, { + + settings: { + ...mockSettings } }); }); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - with filters', async () => { - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { - tree = render( - - - , - ); + tree = renderWithAppContext(, { + + settings: { + ...mockSettings, + filterReasons: ['author'] } }); }); expect(tree).toMatchSnapshot(); diff --git a/src/renderer/components/Oops.test.tsx b/src/renderer/components/Oops.test.tsx index 9eb16be2f..56ea2c9cb 100644 --- a/src/renderer/components/Oops.test.tsx +++ b/src/renderer/components/Oops.test.tsx @@ -1,5 +1,6 @@ -import { act, render } from '@testing-library/react'; +import { act } from '@testing-library/react'; +import { renderWithAppContext } from '../__helpers__/test-utils'; import { ensureStableEmojis } from '../__mocks__/utils'; import { Oops } from './Oops'; @@ -15,20 +16,20 @@ describe('renderer/components/Oops.tsx', () => { emojis: ['🔥'], }; - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { - tree = render(); + tree = renderWithAppContext(); }); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - fallback to unknown error', async () => { - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { - tree = render(); + tree = renderWithAppContext(); }); expect(tree).toMatchSnapshot(); diff --git a/src/renderer/components/Sidebar.test.tsx b/src/renderer/components/Sidebar.test.tsx index 55c7186bf..38803f484 100644 --- a/src/renderer/components/Sidebar.test.tsx +++ b/src/renderer/components/Sidebar.test.tsx @@ -1,18 +1,17 @@ -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { MemoryRouter } from 'react-router-dom'; +import { renderWithAppContext } from '../__helpers__/test-utils'; import { mockAccountNotifications } from '../__mocks__/notifications-mocks'; import { mockAuth, mockSettings } from '../__mocks__/state-mocks'; -import { AppContext } from '../context/App'; import * as comms from '../utils/comms'; import { Sidebar } from './Sidebar'; const mockNavigate = jest.fn(); jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), - useNavigate: () => mockNavigate, -})); + useNavigate: () => mockNavigate })); describe('renderer/components/Sidebar.tsx', () => { const fetchNotifications = jest.fn(); @@ -25,56 +24,47 @@ describe('renderer/components/Sidebar.tsx', () => { }); it('should render itself & its children (logged in)', () => { - const tree = render( - + + , + { + notifications: mockAccountNotifications, auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); expect(tree).toMatchSnapshot(); }); it('should render itself & its children (logged out)', () => { - const tree = render( - + + , + { + isLoggedIn: false, notifications: mockAccountNotifications, auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); expect(tree).toMatchSnapshot(); }); it('should navigate home when clicking the gitify logo', async () => { - render( - + + , + { + isLoggedIn: false, notifications: [], auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); await userEvent.click(screen.getByTestId('sidebar-home')); @@ -84,19 +74,16 @@ describe('renderer/components/Sidebar.tsx', () => { describe('notifications icon', () => { it('opens notifications home when clicked', async () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); await userEvent.click(screen.getByTestId('sidebar-notifications')); @@ -108,38 +95,32 @@ describe('renderer/components/Sidebar.tsx', () => { }); it('renders correct icon when there are no notifications', () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); expect(screen.getByTestId('sidebar-notifications')).toMatchSnapshot(); }); it('renders correct icon when there are notifications', () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); expect(screen.getByTestId('sidebar-notifications')).toMatchSnapshot(); @@ -148,19 +129,16 @@ describe('renderer/components/Sidebar.tsx', () => { describe('Filter notifications', () => { it('go to the filters route', async () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); await userEvent.click(screen.getByTestId('sidebar-filter-notifications')); @@ -169,19 +147,16 @@ describe('renderer/components/Sidebar.tsx', () => { }); it('go to the home if filters path already shown', async () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); await userEvent.click(screen.getByTestId('sidebar-filter-notifications')); @@ -192,19 +167,16 @@ describe('renderer/components/Sidebar.tsx', () => { describe('quick links', () => { it('opens my github issues page', async () => { - render( - + + , + { + isLoggedIn: true, notifications: mockAccountNotifications, auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); await userEvent.click(screen.getByTestId('sidebar-my-issues')); @@ -216,19 +188,16 @@ describe('renderer/components/Sidebar.tsx', () => { }); it('opens my github pull requests page', async () => { - render( - + + , + { + isLoggedIn: true, notifications: mockAccountNotifications, auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); await userEvent.click(screen.getByTestId('sidebar-my-pull-requests')); @@ -242,21 +211,18 @@ describe('renderer/components/Sidebar.tsx', () => { describe('Refresh Notifications', () => { it('should refresh the notifications when status is not loading', async () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, settings: mockSettings, fetchNotifications, - status: 'success', - }} - > - - - - , + status: 'success' }, ); await userEvent.click(screen.getByTestId('sidebar-refresh')); @@ -265,21 +231,18 @@ describe('renderer/components/Sidebar.tsx', () => { }); it('should not refresh the notifications when status is loading', async () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, settings: mockSettings, fetchNotifications, - status: 'loading', - }} - > - - - - , + status: 'loading' }, ); await userEvent.click(screen.getByTestId('sidebar-refresh')); @@ -290,19 +253,16 @@ describe('renderer/components/Sidebar.tsx', () => { describe('Settings', () => { it('go to the settings route', async () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); await userEvent.click(screen.getByTestId('sidebar-settings')); @@ -311,20 +271,17 @@ describe('renderer/components/Sidebar.tsx', () => { }); it('go to the home if settings path already shown', async () => { - render( - + + , + { + isLoggedIn: true, notifications: [], auth: mockAuth, settings: mockSettings, - fetchNotifications, - }} - > - - - - , + fetchNotifications }, ); await userEvent.click(screen.getByTestId('sidebar-settings')); @@ -337,19 +294,16 @@ describe('renderer/components/Sidebar.tsx', () => { it('should quit the app', async () => { const quitAppMock = jest.spyOn(comms, 'quitApp'); - render( - + + , + { + isLoggedIn: false, notifications: [], auth: mockAuth, - settings: mockSettings, - }} - > - - - - , + settings: mockSettings }, ); await userEvent.click(screen.getByTestId('sidebar-quit')); diff --git a/src/renderer/components/__snapshots__/AllRead.test.tsx.snap b/src/renderer/components/__snapshots__/AllRead.test.tsx.snap index 2680d7bb3..7fb910ac5 100644 --- a/src/renderer/components/__snapshots__/AllRead.test.tsx.snap +++ b/src/renderer/components/__snapshots__/AllRead.test.tsx.snap @@ -6,45 +6,56 @@ exports[`renderer/components/AllRead.tsx should render itself & its children - n "baseElement":
- 🎊 -
-
- No new notifications +
+
+ 🎊 +
+
+ No new notifications +
+
@@ -53,45 +64,56 @@ exports[`renderer/components/AllRead.tsx should render itself & its children - n , "container":
- 🎊 -
-
- No new notifications +
+
+ 🎊 +
+
+ No new notifications +
+
@@ -157,45 +179,56 @@ exports[`renderer/components/AllRead.tsx should render itself & its children - w "baseElement":
- 🎊 -
-
- No new filtered notifications +
+
+ 🎊 +
+
+ No new filtered notifications +
+
@@ -204,45 +237,56 @@ exports[`renderer/components/AllRead.tsx should render itself & its children - w , "container":
- 🎊 -
-
- No new filtered notifications +
+
+ 🎊 +
+
+ No new filtered notifications +
+
diff --git a/src/renderer/components/__snapshots__/Oops.test.tsx.snap b/src/renderer/components/__snapshots__/Oops.test.tsx.snap index 73af1dc40..e4a068b56 100644 --- a/src/renderer/components/__snapshots__/Oops.test.tsx.snap +++ b/src/renderer/components/__snapshots__/Oops.test.tsx.snap @@ -6,51 +6,62 @@ exports[`renderer/components/Oops.tsx should render itself & its children - fall "baseElement":
- 🤔 +
+
+ 🤔 +
+
+ Oops! Something went wrong +
+
+
+ Please try again later. +
-
- Oops! Something went wrong -
-
-
- Please try again later.
@@ -58,52 +69,63 @@ exports[`renderer/components/Oops.tsx should render itself & its children - fall , "container":
- 🤔 -
-
- Oops! Something went wrong +
+
+ 🤔 +
+
+ Oops! Something went wrong +
+
+
+ Please try again later. +
-
- Please try again later. -
, @@ -167,51 +189,62 @@ exports[`renderer/components/Oops.tsx should render itself & its children - spec "baseElement":
- 🔥 +
+
+ 🔥 +
+
+ Error title +
+
+
+ Error description +
-
- Error title -
-
-
- Error description
@@ -219,52 +252,63 @@ exports[`renderer/components/Oops.tsx should render itself & its children - spec , "container":
- 🔥 -
-
- Error title +
+
+ 🔥 +
+
+ Error title +
+
+
+ Error description +
-
- Error description -
, diff --git a/src/renderer/components/__snapshots__/Sidebar.test.tsx.snap b/src/renderer/components/__snapshots__/Sidebar.test.tsx.snap index 69431d354..4d0498b4a 100644 --- a/src/renderer/components/__snapshots__/Sidebar.test.tsx.snap +++ b/src/renderer/components/__snapshots__/Sidebar.test.tsx.snap @@ -2,7 +2,7 @@ exports[`renderer/components/Sidebar.tsx notifications icon renders correct icon when there are no notifications 1`] = ` + + + + +
-
- + +
+
- - - - + + +
+
, "container":
- + + + + + + - - - - - - - -
-
- + +
+
- - - - + + +
+
, @@ -637,510 +659,532 @@ exports[`renderer/components/Sidebar.tsx should render itself & its children (lo "baseElement":
- + + + + +
-
- + +
+
- - - - + + +
+
, "container":
- + + + + + + - - - - - - - -
-
- + +
+
- - - - + + +
+
, diff --git a/src/renderer/components/avatars/AvatarWithFallback.test.tsx b/src/renderer/components/avatars/AvatarWithFallback.test.tsx index 090109855..b82fffaf9 100644 --- a/src/renderer/components/avatars/AvatarWithFallback.test.tsx +++ b/src/renderer/components/avatars/AvatarWithFallback.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen } from '@testing-library/react'; +import { fireEvent, screen } from '@testing-library/react'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { type Link, Size } from '../../types'; import { AvatarWithFallback, @@ -16,25 +17,27 @@ describe('renderer/components/avatars/AvatarWithFallback.tsx', () => { }; it('should render avatar - human user', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should render avatar - non-human user', () => { - const tree = render( + const tree = renderWithAppContext( , ); expect(tree).toMatchSnapshot(); }); it('renders the fallback icon when no src url - human user', () => { - const tree = render(); + const tree = renderWithAppContext( + , + ); expect(tree).toMatchSnapshot(); }); it('renders the fallback icon when no src url - non human user', () => { - const tree = render( + const tree = renderWithAppContext( , ); @@ -42,7 +45,7 @@ describe('renderer/components/avatars/AvatarWithFallback.tsx', () => { }); it('renders the fallback icon when the image fails to load (isBroken = true) - human user', () => { - render(); + renderWithAppContext(); // Find the avatar element by its alt text const avatar = screen.getByAltText('gitify-app') as HTMLImageElement; @@ -54,7 +57,7 @@ describe('renderer/components/avatars/AvatarWithFallback.tsx', () => { }); it('renders the fallback icon when the image fails to load (isBroken = true) - non human user', () => { - render(); + renderWithAppContext(); // Find the avatar element by its alt text const avatar = screen.getByAltText('gitify-app') as HTMLImageElement; diff --git a/src/renderer/components/avatars/__snapshots__/AvatarWithFallback.test.tsx.snap b/src/renderer/components/avatars/__snapshots__/AvatarWithFallback.test.tsx.snap index 262ce90c7..c5b1f1085 100644 --- a/src/renderer/components/avatars/__snapshots__/AvatarWithFallback.test.tsx.snap +++ b/src/renderer/components/avatars/__snapshots__/AvatarWithFallback.test.tsx.snap @@ -6,76 +6,98 @@ exports[`renderer/components/avatars/AvatarWithFallback.tsx renders the fallback "baseElement":
-
- @gitify-app +
+ +
+ @gitify-app +
+
, "container":
-
- @gitify-app +
+ +
+ @gitify-app +
+
, @@ -139,76 +161,98 @@ exports[`renderer/components/avatars/AvatarWithFallback.tsx renders the fallback "baseElement":
-
- @gitify-app +
+ +
+ @gitify-app +
+
, "container":
-
- @gitify-app +
+ +
+ @gitify-app +
+
, @@ -348,62 +392,84 @@ exports[`renderer/components/avatars/AvatarWithFallback.tsx should render avatar "baseElement":
- gitify-app
- @gitify-app +
+ gitify-app +
+ @gitify-app +
+
, "container":
- gitify-app
- @gitify-app +
+ gitify-app +
+ @gitify-app +
+
, @@ -467,64 +533,86 @@ exports[`renderer/components/avatars/AvatarWithFallback.tsx should render avatar "baseElement":
- gitify-app
- @gitify-app +
+ gitify-app +
+ @gitify-app +
+
, "container":
- gitify-app
- @gitify-app +
+ gitify-app +
+ @gitify-app +
+
, diff --git a/src/renderer/components/fields/Checkbox.test.tsx b/src/renderer/components/fields/Checkbox.test.tsx index 0050b58c6..9cd8a0bb1 100644 --- a/src/renderer/components/fields/Checkbox.test.tsx +++ b/src/renderer/components/fields/Checkbox.test.tsx @@ -1,5 +1,4 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { Checkbox, type CheckboxProps } from './Checkbox'; describe('renderer/components/fields/Checkbox.tsx', () => { @@ -11,39 +10,43 @@ describe('renderer/components/fields/Checkbox.tsx', () => { }; it('should render - visible', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should render - not visible', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should render - disabled', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should render - tooltip', () => { - const tree = render( + const tree = renderWithAppContext( Hello world} />, ); expect(tree).toMatchSnapshot(); }); it('should render - positive counter unselected', () => { - const tree = render(); + const tree = renderWithAppContext( + , + ); expect(tree).toMatchSnapshot(); }); it('should render - positive counter selected', () => { - const tree = render(); + const tree = renderWithAppContext( + , + ); expect(tree).toMatchSnapshot(); }); it('should render - zero counter', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); }); diff --git a/src/renderer/components/fields/FieldLabel.test.tsx b/src/renderer/components/fields/FieldLabel.test.tsx index 26a243bfa..44a3037d8 100644 --- a/src/renderer/components/fields/FieldLabel.test.tsx +++ b/src/renderer/components/fields/FieldLabel.test.tsx @@ -1,5 +1,4 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { FieldLabel, type FieldLabelProps } from './FieldLabel'; describe('renderer/components/fields/FieldLabel.tsx', () => { @@ -9,7 +8,7 @@ describe('renderer/components/fields/FieldLabel.tsx', () => { }; it('should render', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); }); diff --git a/src/renderer/components/fields/RadioGroup.test.tsx b/src/renderer/components/fields/RadioGroup.test.tsx index 9f7aed66b..2f6f4789f 100644 --- a/src/renderer/components/fields/RadioGroup.test.tsx +++ b/src/renderer/components/fields/RadioGroup.test.tsx @@ -1,5 +1,4 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { RadioGroup, type RadioGroupProps } from './RadioGroup'; describe('renderer/components/fields/RadioGroup.tsx', () => { @@ -15,14 +14,14 @@ describe('renderer/components/fields/RadioGroup.tsx', () => { }; it('should render', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should render as disabled', () => { const mockProps = { ...props, disabled: true }; - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); }); diff --git a/src/renderer/components/fields/Tooltip.test.tsx b/src/renderer/components/fields/Tooltip.test.tsx index 40d59fc6d..88e4d8e36 100644 --- a/src/renderer/components/fields/Tooltip.test.tsx +++ b/src/renderer/components/fields/Tooltip.test.tsx @@ -1,10 +1,8 @@ -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { BaseStyles, ThemeProvider } from '@primer/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { Tooltip, type TooltipProps } from './Tooltip'; describe('renderer/components/fields/Tooltip.tsx', () => { @@ -14,37 +12,17 @@ describe('renderer/components/fields/Tooltip.tsx', () => { }; it('should render', () => { - render( - - - - - - - , - ); + renderWithAppContext(, { + settings: mockSettings, + }); expect(screen.getByTestId('tooltip-test')).toBeInTheDocument(); }); it('should display on mouse enter / leave', async () => { - render( - - - - - - - , - ); + renderWithAppContext(, { + settings: mockSettings, + }); const tooltipElement = screen.getByTestId('tooltip-test'); diff --git a/src/renderer/components/fields/__snapshots__/Checkbox.test.tsx.snap b/src/renderer/components/fields/__snapshots__/Checkbox.test.tsx.snap index 191184d5d..a2f43b44f 100644 --- a/src/renderer/components/fields/__snapshots__/Checkbox.test.tsx.snap +++ b/src/renderer/components/fields/__snapshots__/Checkbox.test.tsx.snap @@ -6,55 +6,77 @@ exports[`renderer/components/fields/Checkbox.tsx should render - disabled 1`] = "baseElement":
- - +
+ + +
+
, "container":
- - +
+ + +
+
, "debug": [Function], @@ -115,9 +137,31 @@ exports[`renderer/components/fields/Checkbox.tsx should render - not visible 1`] { "asFragment": [Function], "baseElement": -
+
+
+
+
+
, - "container":
, + "container":
+
+
+
+
, "debug": [Function], "findAllByAltText": [Function], "findAllByDisplayValue": [Function], @@ -178,63 +222,85 @@ exports[`renderer/components/fields/Checkbox.tsx should render - positive counte "baseElement":
- - - - 5 - +
+ + + + 5 + +
+
, "container":
- - - - 5 - +
+ + + + 5 + +
+
, "debug": [Function], @@ -297,61 +363,83 @@ exports[`renderer/components/fields/Checkbox.tsx should render - positive counte "baseElement":
- - - - 5 - +
+ + + + 5 + +
+
, "container":
- - - - 5 - +
+ + + + 5 + +
+
, "debug": [Function], @@ -414,105 +502,127 @@ exports[`renderer/components/fields/Checkbox.tsx should render - tooltip 1`] = ` "baseElement":
- - - + + +
+
, "container":
- - - + + +
+
, "debug": [Function], @@ -575,53 +685,75 @@ exports[`renderer/components/fields/Checkbox.tsx should render - visible 1`] = ` "baseElement":
- - +
+ + +
+
, "container":
- - +
+ + +
+
, "debug": [Function], @@ -684,63 +816,85 @@ exports[`renderer/components/fields/Checkbox.tsx should render - zero counter 1` "baseElement":
- - - - 0 - +
+ + + + 0 + +
+
, "container":
- - - - 0 - +
+ + + + 0 + +
+
, "debug": [Function], diff --git a/src/renderer/components/fields/__snapshots__/FieldLabel.test.tsx.snap b/src/renderer/components/fields/__snapshots__/FieldLabel.test.tsx.snap index e69ae5347..2f560d960 100644 --- a/src/renderer/components/fields/__snapshots__/FieldLabel.test.tsx.snap +++ b/src/renderer/components/fields/__snapshots__/FieldLabel.test.tsx.snap @@ -5,21 +5,43 @@ exports[`renderer/components/fields/FieldLabel.tsx should render 1`] = ` "asFragment": [Function], "baseElement":
- +
+ +
+
, "container":
- +
+ +
+
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/fields/__snapshots__/RadioGroup.test.tsx.snap b/src/renderer/components/fields/__snapshots__/RadioGroup.test.tsx.snap index 0363ddb3c..9093243d7 100644 --- a/src/renderer/components/fields/__snapshots__/RadioGroup.test.tsx.snap +++ b/src/renderer/components/fields/__snapshots__/RadioGroup.test.tsx.snap @@ -6,46 +6,95 @@ exports[`renderer/components/fields/RadioGroup.tsx should render 1`] = ` "baseElement":
-
- - + +
+ + +
+
+ + +
+
+
+ + , + "container":
+
+
- +
+ + +
+
+ + +
- , - "container":
-
- -
- - -
-
- - -
-
, "debug": [Function], "findAllByAltText": [Function], @@ -199,46 +221,95 @@ exports[`renderer/components/fields/RadioGroup.tsx should render as disabled 1`] "baseElement":
-
- - + +
+ + +
+
+ + +
+
+
+
+ , + "container":
+
+
- +
+ + +
+
+ + +
- , - "container":
-
- -
- - -
-
- - -
-
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/filters/FilterSection.test.tsx b/src/renderer/components/filters/FilterSection.test.tsx index 0d28d4248..cc23c5829 100644 --- a/src/renderer/components/filters/FilterSection.test.tsx +++ b/src/renderer/components/filters/FilterSection.test.tsx @@ -1,11 +1,11 @@ -import { act, render, screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { MarkGithubIcon } from '@primer/octicons-react'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAccountNotifications } from '../../__mocks__/notifications-mocks'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import type { SettingsState } from '../../types'; import { stateFilter } from '../../utils/notifications/filters'; import { FilterSection } from './FilterSection'; @@ -18,54 +18,44 @@ describe('renderer/components/filters/FilterSection.tsx', () => { describe('should render itself & its children', () => { it('with detailed notifications enabled', () => { - const tree = render( - , + { + settings: { ...mockSettings, - detailedNotifications: true, - } as SettingsState, - notifications: mockAccountNotifications, - }} - > - - , + detailedNotifications: true } as SettingsState, + notifications: mockAccountNotifications }, ); expect(tree).toMatchSnapshot(); }); it('with detailed notifications disabled', () => { - const tree = render( - , + { + settings: { ...mockSettings, - detailedNotifications: false, - } as SettingsState, - notifications: mockAccountNotifications, - }} - > - - , + detailedNotifications: false } as SettingsState, + notifications: mockAccountNotifications }, ); expect(tree).toMatchSnapshot(); @@ -74,25 +64,21 @@ describe('renderer/components/filters/FilterSection.tsx', () => { it('should be able to toggle filter value - none already set', async () => { await act(async () => { - render( - , + { + settings: { ...mockSettings, - filterStates: [], - }, + filterStates: [] }, notifications: [], - updateFilter, - }} - > - - , + updateFilter }, ); }); @@ -107,25 +93,21 @@ describe('renderer/components/filters/FilterSection.tsx', () => { it('should be able to toggle filter value - some filters already set', async () => { await act(async () => { - render( - , + { + settings: { ...mockSettings, - filterStates: ['open'], - }, + filterStates: ['open'] }, notifications: [], - updateFilter, - }} - > - - , + updateFilter }, ); }); diff --git a/src/renderer/components/filters/ReasonFilter.test.tsx b/src/renderer/components/filters/ReasonFilter.test.tsx index 81beb41ce..0f741d8d0 100644 --- a/src/renderer/components/filters/ReasonFilter.test.tsx +++ b/src/renderer/components/filters/ReasonFilter.test.tsx @@ -1,22 +1,14 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAccountNotifications } from '../../__mocks__/notifications-mocks'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { ReasonFilter } from './ReasonFilter'; describe('renderer/components/filters/ReasonFilter.tsx', () => { it('should render itself & its children', () => { - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + settings: mockSettings, + notifications: mockAccountNotifications, + }); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/filters/RequiresDetailedNotificationsWarning.test.tsx b/src/renderer/components/filters/RequiresDetailedNotificationsWarning.test.tsx index cd57cb5f8..7b2e8de34 100644 --- a/src/renderer/components/filters/RequiresDetailedNotificationsWarning.test.tsx +++ b/src/renderer/components/filters/RequiresDetailedNotificationsWarning.test.tsx @@ -1,22 +1,14 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAccountNotifications } from '../../__mocks__/notifications-mocks'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { RequiresDetailedNotificationWarning } from './RequiresDetailedNotificationsWarning'; describe('renderer/components/filters/RequiresDetailedNotificationsWarning.tsx', () => { it('should render itself & its children', () => { - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + + settings: mockSettings, + notifications: mockAccountNotifications }); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/filters/SearchFilter.test.tsx b/src/renderer/components/filters/SearchFilter.test.tsx index 2299ce16c..82e4d8549 100644 --- a/src/renderer/components/filters/SearchFilter.test.tsx +++ b/src/renderer/components/filters/SearchFilter.test.tsx @@ -1,7 +1,7 @@ -import { fireEvent, render, screen } from '@testing-library/react'; +import { fireEvent, screen } from '@testing-library/react'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { SearchFilter } from './SearchFilter'; const updateFilter = jest.fn(); @@ -13,11 +13,8 @@ describe('renderer/components/filters/SearchFilter.tsx', () => { describe('Include Search Tokens', () => { it('adds include actor token with prefix', () => { - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, updateFilter }); const includeInput = screen.getByTitle('Include searches'); fireEvent.change(includeInput, { target: { value: 'author:octocat' } }); @@ -31,11 +28,8 @@ describe('renderer/components/filters/SearchFilter.tsx', () => { }); it('adds include org token with prefix', () => { - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, updateFilter }); const includeInput = screen.getByTitle('Include searches'); fireEvent.change(includeInput, { target: { value: 'org:gitify-app' } }); @@ -49,16 +43,12 @@ describe('renderer/components/filters/SearchFilter.tsx', () => { }); it('adds include repo token with prefix', () => { - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, updateFilter }); const includeInput = screen.getByTitle('Include searches'); fireEvent.change(includeInput, { - target: { value: 'repo:gitify-app/gitify' }, - }); + target: { value: 'repo:gitify-app/gitify' } }); fireEvent.keyDown(includeInput, { key: 'Enter' }); expect(updateFilter).toHaveBeenCalledWith( @@ -69,16 +59,12 @@ describe('renderer/components/filters/SearchFilter.tsx', () => { }); it('prevent unrecognized include prefixes', () => { - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, updateFilter }); const includeInput = screen.getByTitle('Include searches'); fireEvent.change(includeInput, { - target: { value: 'some:search' }, - }); + target: { value: 'some:search' } }); fireEvent.keyDown(includeInput, { key: 'Enter' }); expect(updateFilter).not.toHaveBeenCalledWith(); @@ -87,11 +73,8 @@ describe('renderer/components/filters/SearchFilter.tsx', () => { describe('Exclude Search Tokens', () => { it('adds exclude actor token with prefix', () => { - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, updateFilter }); const includeInput = screen.getByTitle('Exclude searches'); fireEvent.change(includeInput, { target: { value: 'author:octocat' } }); @@ -105,11 +88,8 @@ describe('renderer/components/filters/SearchFilter.tsx', () => { }); it('adds exclude org token with prefix', () => { - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, updateFilter }); const excludeInput = screen.getByTitle('Exclude searches'); fireEvent.change(excludeInput, { target: { value: 'org:gitify-app' } }); @@ -123,16 +103,12 @@ describe('renderer/components/filters/SearchFilter.tsx', () => { }); it('adds exclude repo token with prefix', () => { - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, updateFilter }); const excludeInput = screen.getByTitle('Exclude searches'); fireEvent.change(excludeInput, { - target: { value: 'repo:gitify-app/gitify' }, - }); + target: { value: 'repo:gitify-app/gitify' } }); fireEvent.keyDown(excludeInput, { key: 'Enter' }); expect(updateFilter).toHaveBeenCalledWith( @@ -143,16 +119,12 @@ describe('renderer/components/filters/SearchFilter.tsx', () => { }); it('prevent unrecognized exclude prefixes', () => { - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, updateFilter }); const excludeInput = screen.getByTitle('Exclude searches'); fireEvent.change(excludeInput, { - target: { value: 'some:search' }, - }); + target: { value: 'some:search' } }); fireEvent.keyDown(excludeInput, { key: 'Enter' }); expect(updateFilter).not.toHaveBeenCalledWith(); diff --git a/src/renderer/components/filters/SearchFilterSuggestions.test.tsx b/src/renderer/components/filters/SearchFilterSuggestions.test.tsx index 49faa8b3e..6ed375dbb 100644 --- a/src/renderer/components/filters/SearchFilterSuggestions.test.tsx +++ b/src/renderer/components/filters/SearchFilterSuggestions.test.tsx @@ -1,91 +1,69 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import type { SettingsState } from '../../types'; import { SearchFilterSuggestions } from './SearchFilterSuggestions'; describe('renderer/components/filters/SearchFilterSuggestions.tsx', () => { it('should render itself & its children - closed', () => { - const tree = render( - , + { + settings: { ...mockSettings, - detailedNotifications: false, - } as SettingsState, - }} - > - - , + detailedNotifications: false } as SettingsState }, ); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - open', () => { - const tree = render( - , + { + settings: { ...mockSettings, - detailedNotifications: true, - } as SettingsState, - }} - > - - , + detailedNotifications: true } as SettingsState }, ); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - open with detailed enabled', () => { - const tree = render( - , + { + settings: { ...mockSettings, - detailedNotifications: true, - } as SettingsState, - }} - > - - , + detailedNotifications: true } as SettingsState }, ); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - input token invalid', () => { - const tree = render( - , + { + settings: { ...mockSettings, - detailedNotifications: false, - } as SettingsState, - }} - > - - , + detailedNotifications: false } as SettingsState }, ); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - input token valid', () => { - const tree = render( - , + { + settings: { ...mockSettings, - detailedNotifications: false, - } as SettingsState, - }} - > - - , + detailedNotifications: false } as SettingsState }, ); expect(tree).toMatchSnapshot(); diff --git a/src/renderer/components/filters/StateFilter.test.tsx b/src/renderer/components/filters/StateFilter.test.tsx index a924580ac..9c57c980a 100644 --- a/src/renderer/components/filters/StateFilter.test.tsx +++ b/src/renderer/components/filters/StateFilter.test.tsx @@ -1,26 +1,17 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAccountNotifications } from '../../__mocks__/notifications-mocks'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import type { SettingsState } from '../../types'; import { StateFilter } from './StateFilter'; describe('renderer/components/filters/StateFilter.tsx', () => { it('should render itself & its children', () => { - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + + settings: { + ...mockSettings, + detailedNotifications: true } as SettingsState, + notifications: mockAccountNotifications }); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/filters/SubjectTypeFilter.test.tsx b/src/renderer/components/filters/SubjectTypeFilter.test.tsx index 1015df381..06cf7f8e2 100644 --- a/src/renderer/components/filters/SubjectTypeFilter.test.tsx +++ b/src/renderer/components/filters/SubjectTypeFilter.test.tsx @@ -1,25 +1,16 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAccountNotifications } from '../../__mocks__/notifications-mocks'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import type { SettingsState } from '../../types'; import { SubjectTypeFilter } from './SubjectTypeFilter'; describe('renderer/components/filters/SubjectTypeFilter.tsx', () => { it('should render itself & its children', () => { - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + + settings: { + ...mockSettings } as SettingsState, + notifications: mockAccountNotifications }); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/filters/UserTypeFilter.test.tsx b/src/renderer/components/filters/UserTypeFilter.test.tsx index fa3009361..873479901 100644 --- a/src/renderer/components/filters/UserTypeFilter.test.tsx +++ b/src/renderer/components/filters/UserTypeFilter.test.tsx @@ -1,26 +1,17 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAccountNotifications } from '../../__mocks__/notifications-mocks'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import type { SettingsState } from '../../types'; import { UserTypeFilter } from './UserTypeFilter'; describe('renderer/components/filters/UserTypeFilter.tsx', () => { it('should render itself & its children', () => { - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + + settings: { + ...mockSettings, + detailedNotifications: true } as SettingsState, + notifications: mockAccountNotifications }); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/filters/__snapshots__/FilterSection.test.tsx.snap b/src/renderer/components/filters/__snapshots__/FilterSection.test.tsx.snap index 089ad252c..256207e3a 100644 --- a/src/renderer/components/filters/__snapshots__/FilterSection.test.tsx.snap +++ b/src/renderer/components/filters/__snapshots__/FilterSection.test.tsx.snap @@ -458,539 +458,561 @@ exports[`renderer/components/filters/FilterSection.tsx should render itself & it "asFragment": [Function], "baseElement":
-
- -
+
+ +
+
+ +

+ FilterSectionTitle +

+
+
+
- -

+ Closed + + + + 0 + +

+
- FilterSectionTitle - -
-
-
-
-
- - -
+
- - - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - -
+
- - - - - 1 - -
-
- - -
+
- - - - - 3 - -
+ + + + 3 + +
+
+
- + , "container":
-
- -
+
+ +
+
+ +

+ FilterSectionTitle +

+
+
+
- -

+ Closed + + + + 0 + +

+
- FilterSectionTitle - -
-
-
-
-
- - -
+
- - - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - -
+
- - - - - 1 - -
-
- - -
+
- - - - - 3 - -
+ + + + 3 + +
+
+ - + , "debug": [Function], "findAllByAltText": [Function], @@ -1051,539 +1073,561 @@ exports[`renderer/components/filters/FilterSection.tsx should render itself & it "asFragment": [Function], "baseElement":
-
- -
+
+ +
+
+ +

+ FilterSectionTitle +

+
+
+
- -

+ Closed + + + + 0 + +

+
- FilterSectionTitle - -
-
-
-
-
- - -
+
- - - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - -
+
- - - - - 1 - -
-
- - -
+
- - - - - 3 - -
+ + + + 3 + +
+
+ - + , "container":
-
- -
+
+ +
+
+ +

+ FilterSectionTitle +

+
+
+
- -

+ Closed + + + + 0 + +

+
- FilterSectionTitle - -
-
-
-
-
- - -
+
- - - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - -
+
- - - - - 1 - -
-
- - -
+
- - - - - 3 - -
+ + + + 3 + +
+
+ - + , "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/filters/__snapshots__/ReasonFilter.test.tsx.snap b/src/renderer/components/filters/__snapshots__/ReasonFilter.test.tsx.snap index fa2882829..bf54b0923 100644 --- a/src/renderer/components/filters/__snapshots__/ReasonFilter.test.tsx.snap +++ b/src/renderer/components/filters/__snapshots__/ReasonFilter.test.tsx.snap @@ -5,1755 +5,1777 @@ exports[`renderer/components/filters/ReasonFilter.tsx should render itself & its "asFragment": [Function], "baseElement":
-
- -
+
+ +
+
+ +

+ Reason +

+ +
+
+
- -

- Reason -

- -
-
-
-
-
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 1 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 3 - -
-
- - -
+
- - - - - 0 - -
+ + + + 0 + +
+
+ - + , "container":
-
- -
+
+ +
+
+ +

+ Reason +

+ +
+
+
- -

- Reason -

- -
-
-
-
-
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 1 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 0 - -
-
- - -
+
- - - - - 3 - -
-
- - -
+
- - - - - 0 - -
+ + + + 0 + +
+
+ - + , "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/filters/__snapshots__/RequiresDetailedNotificationsWarning.test.tsx.snap b/src/renderer/components/filters/__snapshots__/RequiresDetailedNotificationsWarning.test.tsx.snap index fa47e974f..8bcb0d895 100644 --- a/src/renderer/components/filters/__snapshots__/RequiresDetailedNotificationsWarning.test.tsx.snap +++ b/src/renderer/components/filters/__snapshots__/RequiresDetailedNotificationsWarning.test.tsx.snap @@ -5,33 +5,55 @@ exports[`renderer/components/filters/RequiresDetailedNotificationsWarning.tsx sh "asFragment": [Function], "baseElement":
- - ⚠️ This filter requires the - - Detailed Notifications - - - setting to be enabled. - + + ⚠️ This filter requires the + + Detailed Notifications + + + setting to be enabled. + +
+ , "container":
- - ⚠️ This filter requires the - - Detailed Notifications - - - setting to be enabled. - + + ⚠️ This filter requires the + + Detailed Notifications + + + setting to be enabled. + +
+ , "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/filters/__snapshots__/SearchFilterSuggestions.test.tsx.snap b/src/renderer/components/filters/__snapshots__/SearchFilterSuggestions.test.tsx.snap index 0c72c3a55..990f1336b 100644 --- a/src/renderer/components/filters/__snapshots__/SearchFilterSuggestions.test.tsx.snap +++ b/src/renderer/components/filters/__snapshots__/SearchFilterSuggestions.test.tsx.snap @@ -4,9 +4,31 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i { "asFragment": [Function], "baseElement": -
+
+
+
+
+
, - "container":
, + "container":
+
+
+
+
, "debug": [Function], "findAllByAltText": [Function], "findAllByDisplayValue": [Function], @@ -67,32 +89,43 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i "baseElement":
-
- +
- Please use one of the supported filters [ - org, repo - ] - +
+ + Please use one of the supported filters [ + org, repo + ] + +
+
@@ -101,32 +134,43 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i , "container":
-
- +
- Please use one of the supported filters [ - org, repo - ] - +
+ + Please use one of the supported filters [ + org, repo + ] + +
+
@@ -192,44 +236,55 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i "baseElement":
-
+
- - repo: - - - filter by repository full name - +
+
+ + repo: + + + filter by repository full name + +
+
@@ -239,44 +294,55 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i , "container":
-
+
- - repo: - - - filter by repository full name - +
+
+ + repo: + + + filter by repository full name + +
+
@@ -343,88 +409,99 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i "baseElement":
-
-
- - author: - - - filter by notification author - -
-
-
-
- - org: - - - filter by organization owner - -
-
-
+
- - repo: - - - filter by repository full name - +
+
+ + author: + + + filter by notification author + +
+
+
+
+ + org: + + + filter by organization owner + +
+
+
+
+ + repo: + + + filter by repository full name + +
+
@@ -434,88 +511,99 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i , "container":
-
-
- - author: - - - filter by notification author - -
-
-
-
- - org: - - - filter by organization owner - -
-
-
+
- - repo: - - - filter by repository full name - +
+
+ + author: + + + filter by notification author + +
+
+
+
+ + org: + + + filter by organization owner + +
+
+
+
+ + repo: + + + filter by repository full name + +
+
@@ -582,88 +670,99 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i "baseElement":
-
-
- - author: - - - filter by notification author - -
-
-
-
- - org: - - - filter by organization owner - -
-
-
+
- - repo: - - - filter by repository full name - +
+
+ + author: + + + filter by notification author + +
+
+
+
+ + org: + + + filter by organization owner + +
+
+
+
+ + repo: + + + filter by repository full name + +
+
@@ -673,88 +772,99 @@ exports[`renderer/components/filters/SearchFilterSuggestions.tsx should render i , "container":
-
-
- - author: - - - filter by notification author - -
-
-
-
- - org: - - - filter by organization owner - -
-
-
+
- - repo: - - - filter by repository full name - +
+
+ + author: + + + filter by notification author + +
+
+
+
+ + org: + + + filter by organization owner + +
+
+
+
+ + repo: + + + filter by repository full name + +
+
diff --git a/src/renderer/components/filters/__snapshots__/StateFilter.test.tsx.snap b/src/renderer/components/filters/__snapshots__/StateFilter.test.tsx.snap index 2be84f3d9..049ef2dfd 100644 --- a/src/renderer/components/filters/__snapshots__/StateFilter.test.tsx.snap +++ b/src/renderer/components/filters/__snapshots__/StateFilter.test.tsx.snap @@ -5,59 +5,343 @@ exports[`renderer/components/filters/StateFilter.tsx should render itself & its "asFragment": [Function], "baseElement":
-
- -
+
+ +
+
+ +

+ State +

+ +
+
+
- + 0 + +
+
+ - -

+ Draft + + + 0 + +

+
- State - -
+
+ + + + + 1 + +
+
+ + + + + 3 + +
+
+
+
+
+
+ , + "container":
+
+
+
+ +
+
- +

+ State +

+ +
-
- -
+
- - - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - - - - 1 - -
-
- - - + - - - - - 3 - -
-
- -
- , - "container":
-
- -
-
-
+
- - - -

- State -

- -
-
-
-
-
- - -
+
- - - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - -
+
- - - - - 1 - -
-
- - -
+
- - - - - 3 - -
+ + + + 3 + +
+
+
- +
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/filters/__snapshots__/SubjectTypeFilter.test.tsx.snap b/src/renderer/components/filters/__snapshots__/SubjectTypeFilter.test.tsx.snap index 5d17d9770..16eb2ef0a 100644 --- a/src/renderer/components/filters/__snapshots__/SubjectTypeFilter.test.tsx.snap +++ b/src/renderer/components/filters/__snapshots__/SubjectTypeFilter.test.tsx.snap @@ -5,56 +5,397 @@ exports[`renderer/components/filters/SubjectTypeFilter.tsx should render itself "asFragment": [Function], "baseElement":
-
- -
+
+ +
+
+ +

+ Type +

+ +
+
+
- + 0 + +
+
+ + + + 0 + +
+
+ + + + 0 + +
+
+ + + + 0 + +
+
+ + + + 0 + +
+
+ + + + 2 + +
+
+ + + + 1 + +
+
+ + + + 1 + +
+
+ + + + 0 + +
+
+ - -

- Type -

-
+
+
+
+
+
+ , + "container":
+
+
+
+ +
+
- +

+ Type +

+ +
-
- -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
+
- - - - 0 - -
-
- - - - 2 - -
-
- - - - 1 - -
-
- -
+
- Release - - + + + 0 + +
+
- 1 - -
-
- -
+
- Vulnerability Alert - - + + + 0 + +
+
- 0 - -
-
- -
+
- Workflow Run - - + + + 2 + +
+
- 0 - -
-
- -
- , - "container":
-
- -
-
- + + + 1 + +
+
- - -

+ Release + + + 1 + +

+
- Type - -
+
- - + + + + 0 + +
-
- -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - - - 0 - -
-
- - - - 2 - -
-
- - - - 1 - -
-
- - - - 1 - -
-
- - - - 0 - -
-
- - - - 0 - -
+
- +
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/filters/__snapshots__/UserTypeFilter.test.tsx.snap b/src/renderer/components/filters/__snapshots__/UserTypeFilter.test.tsx.snap index aa0485c8e..027b9be44 100644 --- a/src/renderer/components/filters/__snapshots__/UserTypeFilter.test.tsx.snap +++ b/src/renderer/components/filters/__snapshots__/UserTypeFilter.test.tsx.snap @@ -5,50 +5,317 @@ exports[`renderer/components/filters/UserTypeFilter.tsx should render itself & i "asFragment": [Function], "baseElement":
-
- -
+
+ +
+
+ +

+ User Type +

+ +
+
+
- + 0 + +
+
+ + + + 0 + +
+
- - -

+ User + + + 1 + +

+
+
+
+
+
+ , + "container":
+
+
+
+ +
+
+ +

+ User Type +

+ +
+
+
+
+
+ + + + 0 +
-
- -
-
- - - - - 0 - -
-
- - - - 0 - -
-
- - - - 1 - -
-
-
-
- , - "container":
-
- -
-
- + 0 + +
+
- - -

- User Type -

- + User + + + 1 + +
-
- -
-
- - - - - 0 - -
-
- - - - 0 - -
-
- - - - 1 - -
+
- +
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/icons/LogoIcon.test.tsx b/src/renderer/components/icons/LogoIcon.test.tsx index ccd4f61a3..754ce5fec 100644 --- a/src/renderer/components/icons/LogoIcon.test.tsx +++ b/src/renderer/components/icons/LogoIcon.test.tsx @@ -1,25 +1,26 @@ -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { Size } from '../../types'; import { LogoIcon } from './LogoIcon'; describe('renderer/components/icons/LogoIcon.tsx', () => { it('renders correctly (light)', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('renders correctly (dark)', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should click on the logo', async () => { const onClick = jest.fn(); - render(); + renderWithAppContext(); await userEvent.click(screen.getByLabelText('Gitify Logo')); @@ -27,19 +28,19 @@ describe('renderer/components/icons/LogoIcon.tsx', () => { }); it('should render small size', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should render medium size', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should render large size', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/icons/__snapshots__/LogoIcon.test.tsx.snap b/src/renderer/components/icons/__snapshots__/LogoIcon.test.tsx.snap index b7226d4e1..12867d6a7 100644 --- a/src/renderer/components/icons/__snapshots__/LogoIcon.test.tsx.snap +++ b/src/renderer/components/icons/__snapshots__/LogoIcon.test.tsx.snap @@ -5,97 +5,119 @@ exports[`renderer/components/icons/LogoIcon.tsx renders correctly (dark) 1`] = ` "asFragment": [Function], "baseElement":
- + + + + + + + + + + +
+
, "container":
- + + + + + + + + + + +
+
, "debug": [Function], "findAllByAltText": [Function], @@ -156,97 +178,119 @@ exports[`renderer/components/icons/LogoIcon.tsx renders correctly (light) 1`] = "asFragment": [Function], "baseElement":
- + + + + + + + + + + +
+
, "container":
- + + + + + + + + + + +
+
, "debug": [Function], "findAllByAltText": [Function], @@ -307,97 +351,119 @@ exports[`renderer/components/icons/LogoIcon.tsx should render large size 1`] = ` "asFragment": [Function], "baseElement":
- + + + + + + + + + + +
+
, "container":
- + + + + + + + + + + +
+
, "debug": [Function], "findAllByAltText": [Function], @@ -458,97 +524,119 @@ exports[`renderer/components/icons/LogoIcon.tsx should render medium size 1`] = "asFragment": [Function], "baseElement":
- + + + + + + + + + + +
+
, "container":
- + + + + + + + + + + +
+
, "debug": [Function], "findAllByAltText": [Function], @@ -609,97 +697,119 @@ exports[`renderer/components/icons/LogoIcon.tsx should render small size 1`] = ` "asFragment": [Function], "baseElement":
- + + + + + + + + + + +
+
, "container":
- + + + + + + + + + + +
+
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/layout/AppLayout.test.tsx b/src/renderer/components/layout/AppLayout.test.tsx index 2a41945d2..b757824cc 100644 --- a/src/renderer/components/layout/AppLayout.test.tsx +++ b/src/renderer/components/layout/AppLayout.test.tsx @@ -1,25 +1,11 @@ -import { render } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAuth, mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { AppLayout } from './AppLayout'; describe('renderer/components/layout/AppLayout.tsx', () => { it('should render itself & its children', () => { - const tree = render( - - - Test - - , - ); + const tree = renderWithAppContext(Test, { + auth: mockAuth, settings: mockSettings, notifications: [] }); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/layout/Centered.test.tsx b/src/renderer/components/layout/Centered.test.tsx index 9bb464304..f84b5dc33 100644 --- a/src/renderer/components/layout/Centered.test.tsx +++ b/src/renderer/components/layout/Centered.test.tsx @@ -1,16 +1,19 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { Centered } from './Centered'; describe('renderer/components/layout/Centered.tsx', () => { it('should render itself & its children - full height true', () => { - const tree = render(Test); + const tree = renderWithAppContext( + Test, + ); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - full height false', () => { - const tree = render(Test); + const tree = renderWithAppContext( + Test, + ); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/layout/Contents.test.tsx b/src/renderer/components/layout/Contents.test.tsx index c8d2bce0d..554ad4942 100644 --- a/src/renderer/components/layout/Contents.test.tsx +++ b/src/renderer/components/layout/Contents.test.tsx @@ -1,10 +1,9 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { Contents } from './Contents'; describe('renderer/components/layout/Contents.tsx', () => { it('should render itself & its children', () => { - const tree = render(Test); + const tree = renderWithAppContext(Test); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/layout/EmojiSplash.test.tsx b/src/renderer/components/layout/EmojiSplash.test.tsx index a8fb9529e..044a30b54 100644 --- a/src/renderer/components/layout/EmojiSplash.test.tsx +++ b/src/renderer/components/layout/EmojiSplash.test.tsx @@ -1,14 +1,17 @@ -import { act, render } from '@testing-library/react'; +import { act } from '@testing-library/react'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { EmojiSplash } from './EmojiSplash'; describe('renderer/components/layout/EmojiSplash.tsx', () => { it('should render itself & its children - heading only', async () => { - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { tree = await act(async () => { - return render(); + return renderWithAppContext( + , + ); }); }); @@ -16,11 +19,11 @@ describe('renderer/components/layout/EmojiSplash.tsx', () => { }); it('should render itself & its children - heading and sub-heading', async () => { - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { tree = await act(async () => { - return render( + return renderWithAppContext( { it('should render itself & its children', () => { - const tree = render(Test); + const tree = renderWithAppContext(Test); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/layout/__snapshots__/Centered.test.tsx.snap b/src/renderer/components/layout/__snapshots__/Centered.test.tsx.snap index 1e88c7fb1..e93e2714c 100644 --- a/src/renderer/components/layout/__snapshots__/Centered.test.tsx.snap +++ b/src/renderer/components/layout/__snapshots__/Centered.test.tsx.snap @@ -6,27 +6,49 @@ exports[`renderer/components/layout/Centered.tsx should render itself & its chil "baseElement":
- Test +
+
+ Test +
+
, "container":
- Test +
+
+ Test +
+
, "debug": [Function], @@ -89,27 +111,49 @@ exports[`renderer/components/layout/Centered.tsx should render itself & its chil "baseElement":
- Test +
+
+ Test +
+
, "container":
- Test +
+
+ Test +
+
, "debug": [Function], diff --git a/src/renderer/components/layout/__snapshots__/Contents.test.tsx.snap b/src/renderer/components/layout/__snapshots__/Contents.test.tsx.snap index fd184a9b4..15ccc0ec3 100644 --- a/src/renderer/components/layout/__snapshots__/Contents.test.tsx.snap +++ b/src/renderer/components/layout/__snapshots__/Contents.test.tsx.snap @@ -6,17 +6,39 @@ exports[`renderer/components/layout/Contents.tsx should render itself & its chil "baseElement":
- Test +
+
+ Test +
+
, "container":
- Test +
+
+ Test +
+
, "debug": [Function], diff --git a/src/renderer/components/layout/__snapshots__/EmojiSplash.test.tsx.snap b/src/renderer/components/layout/__snapshots__/EmojiSplash.test.tsx.snap index 5c88794fc..595073fcb 100644 --- a/src/renderer/components/layout/__snapshots__/EmojiSplash.test.tsx.snap +++ b/src/renderer/components/layout/__snapshots__/EmojiSplash.test.tsx.snap @@ -6,51 +6,62 @@ exports[`renderer/components/layout/EmojiSplash.tsx should render itself & its c "baseElement":
- 🍺 +
+
+ 🍺 +
+
+ Test Heading +
+
+
+ Test Sub-Heading +
-
- Test Heading -
-
-
- Test Sub-Heading
@@ -58,52 +69,63 @@ exports[`renderer/components/layout/EmojiSplash.tsx should render itself & its c , "container":
- 🍺 -
-
- Test Heading +
+
+ 🍺 +
+
+ Test Heading +
+
+
+ Test Sub-Heading +
-
- Test Sub-Heading -
, @@ -167,45 +189,56 @@ exports[`renderer/components/layout/EmojiSplash.tsx should render itself & its c "baseElement":
- 🍺 -
-
- Test Heading +
+
+ 🍺 +
+
+ Test Heading +
+
@@ -214,45 +247,56 @@ exports[`renderer/components/layout/EmojiSplash.tsx should render itself & its c , "container":
- 🍺 -
-
- Test Heading +
+
+ 🍺 +
+
+ Test Heading +
+
diff --git a/src/renderer/components/layout/__snapshots__/Page.test.tsx.snap b/src/renderer/components/layout/__snapshots__/Page.test.tsx.snap index 4c981c9d6..9c849210b 100644 --- a/src/renderer/components/layout/__snapshots__/Page.test.tsx.snap +++ b/src/renderer/components/layout/__snapshots__/Page.test.tsx.snap @@ -6,19 +6,41 @@ exports[`renderer/components/layout/Page.tsx should render itself & its children "baseElement":
- Test +
+
+ Test +
+
, "container":
- Test +
+
+ Test +
+
, "debug": [Function], diff --git a/src/renderer/components/metrics/MetricGroup.test.tsx b/src/renderer/components/metrics/MetricGroup.test.tsx index c74849a39..744f8a858 100644 --- a/src/renderer/components/metrics/MetricGroup.test.tsx +++ b/src/renderer/components/metrics/MetricGroup.test.tsx @@ -1,7 +1,5 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import type { Milestone } from '../../typesGitHub'; import { mockSingleNotification } from '../../utils/api/__mocks__/response-mocks'; import { MetricGroup } from './MetricGroup'; @@ -12,18 +10,11 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { const mockNotification = mockSingleNotification; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: { ...mockSettings, showPills: false } }); expect(tree).toMatchSnapshot(); }); }); @@ -34,18 +25,11 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { mockNotification.subject.linkedIssues = ['#1']; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); @@ -54,18 +38,11 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { mockNotification.subject.linkedIssues = ['#1', '#2']; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); }); @@ -76,18 +53,11 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { mockNotification.subject.comments = null; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); @@ -96,18 +66,11 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { mockNotification.subject.comments = 1; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); @@ -116,18 +79,11 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { mockNotification.subject.comments = 2; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); }); @@ -138,18 +94,11 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { mockNotification.subject.labels = ['enhancement', 'good-first-issue']; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); }); @@ -159,22 +108,14 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { const mockNotification = mockSingleNotification; mockNotification.subject.milestone = { title: 'Milestone 1', - state: 'open', - } as Milestone; + state: 'open' } as Milestone; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); @@ -182,22 +123,14 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => { const mockNotification = mockSingleNotification; mockNotification.subject.milestone = { title: 'Milestone 1', - state: 'closed', - } as Milestone; + state: 'closed' } as Milestone; const props = { - notification: mockNotification, - }; - - const tree = render( - - - , - ); + notification: mockNotification }; + + const tree = renderWithAppContext(, { + + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); }); diff --git a/src/renderer/components/metrics/MetricPill.test.tsx b/src/renderer/components/metrics/MetricPill.test.tsx index f6e37ff1d..9f619f6c9 100644 --- a/src/renderer/components/metrics/MetricPill.test.tsx +++ b/src/renderer/components/metrics/MetricPill.test.tsx @@ -1,7 +1,6 @@ -import { render } from '@testing-library/react'; - import { MarkGithubIcon } from '@primer/octicons-react'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { IconColor } from '../../types'; import { MetricPill, type MetricPillProps } from './MetricPill'; @@ -13,7 +12,7 @@ describe('renderer/components/metrics/MetricPill.tsx', () => { icon: MarkGithubIcon, color: IconColor.GREEN, }; - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); @@ -23,7 +22,7 @@ describe('renderer/components/metrics/MetricPill.tsx', () => { icon: MarkGithubIcon, color: IconColor.GREEN, }; - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); }); diff --git a/src/renderer/components/metrics/__snapshots__/MetricGroup.test.tsx.snap b/src/renderer/components/metrics/__snapshots__/MetricGroup.test.tsx.snap index be088f070..a4ea8ade5 100644 --- a/src/renderer/components/metrics/__snapshots__/MetricGroup.test.tsx.snap +++ b/src/renderer/components/metrics/__snapshots__/MetricGroup.test.tsx.snap @@ -6,325 +6,347 @@ exports[`renderer/components/metrics/MetricGroup.tsx comment pills should render "baseElement":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="1 comment" + > +
+ + + 1 + +
-
+
, "container":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="1 comment" + > +
+ + + 1 + +
-
+
, "debug": [Function], @@ -387,325 +409,347 @@ exports[`renderer/components/metrics/MetricGroup.tsx comment pills should render "baseElement":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="2 comments" + > +
+ + + 2 + +
-
+
, "container":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="2 comments" + > +
+ + + 2 + +
-
+
, "debug": [Function], @@ -768,249 +812,271 @@ exports[`renderer/components/metrics/MetricGroup.tsx comment pills should render "baseElement":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
+
, "container":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
+
, "debug": [Function], @@ -1073,403 +1139,425 @@ exports[`renderer/components/metrics/MetricGroup.tsx label pills should render l "baseElement":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="2 comments" + > +
+ + + 2 + +
-
-
- -
- - 2 +
+ + + 2 + +
-
+
, "container":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="2 comments" + > +
+ + + 2 + +
-
-
- -
- - 2 +
+ + + 2 + +
-
+
, "debug": [Function], @@ -1532,249 +1620,271 @@ exports[`renderer/components/metrics/MetricGroup.tsx linked issue pills should r "baseElement":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
+
, "container":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
+
, "debug": [Function], @@ -1837,249 +1947,271 @@ exports[`renderer/components/metrics/MetricGroup.tsx linked issue pills should r "baseElement":
-
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issue #1" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
+
, "container":
-
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issue #1" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
+
, "debug": [Function], @@ -2142,469 +2274,491 @@ exports[`renderer/components/metrics/MetricGroup.tsx milestone pills should rend "baseElement":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="2 comments" + > +
+ + + 2 + +
-
-
- -
- - 2 +
+ + + 2 + +
+
+ +
+ +
-
- -
- -
-
+
, "container":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="2 comments" + > +
+ + + 2 + +
-
-
- -
- +
+ + + 2 + +
+ - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Milestone 1" + > +
+ +
-
- -
- -
-
+
, "debug": [Function], @@ -2667,469 +2821,491 @@ exports[`renderer/components/metrics/MetricGroup.tsx milestone pills should rend "baseElement":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="2 comments" + > +
+ + + 2 + +
-
-
- -
- - 2 +
+ + + 2 + +
+
+ +
+ +
-
- -
- -
-
+
, "container":
-
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Linked to issues #1, #2" + > +
+ + + 2 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="octocat approved these changes" + > +
+ + + 1 + +
-
-
- -
- - 1 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="gitify-app requested changes" + > +
+ + + 1 + +
-
-
- -
- - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="2 comments" + > +
+ + + 2 + +
-
-
- -
- +
+ + + 2 + +
+ - 2 + class="hover:bg-gitify-notification-pill-hover prc-Label-Label--LG6X" + data-size="small" + data-variant="secondary" + title="Milestone 1" + > +
+ +
-
- -
- -
-
+
, "debug": [Function], @@ -3190,9 +3366,31 @@ exports[`renderer/components/metrics/MetricGroup.tsx showPills disabled should n { "asFragment": [Function], "baseElement": -
+
+
+
+
+
, - "container":
, + "container":
+
+
+
+
, "debug": [Function], "findAllByAltText": [Function], "findAllByDisplayValue": [Function], diff --git a/src/renderer/components/metrics/__snapshots__/MetricPill.test.tsx.snap b/src/renderer/components/metrics/__snapshots__/MetricPill.test.tsx.snap index 6e4b0941a..8e4cd72c1 100644 --- a/src/renderer/components/metrics/__snapshots__/MetricPill.test.tsx.snap +++ b/src/renderer/components/metrics/__snapshots__/MetricPill.test.tsx.snap @@ -5,85 +5,107 @@ exports[`renderer/components/metrics/MetricPill.tsx should render with metric 1` "asFragment": [Function], "baseElement":
-
- - 1 +
+ + + 1 + +
-
+
, "container":
-
- - 1 +
+ + + 1 + +
-
+
, "debug": [Function], "findAllByAltText": [Function], @@ -144,75 +166,97 @@ exports[`renderer/components/metrics/MetricPill.tsx should render without metric "asFragment": [Function], "baseElement":
-
- +
+ +
+
-
+
, "container":
-
- +
+ +
+
-
+
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/notifications/AccountNotifications.test.tsx b/src/renderer/components/notifications/AccountNotifications.test.tsx index 0c848f588..4b8ca14ff 100644 --- a/src/renderer/components/notifications/AccountNotifications.test.tsx +++ b/src/renderer/components/notifications/AccountNotifications.test.tsx @@ -1,21 +1,19 @@ -import { act, render, screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAuth, mockGitHubCloudAccount, - mockSettings, -} from '../../__mocks__/state-mocks'; + mockSettings } from '../../__mocks__/state-mocks'; import { ensureStableEmojis } from '../../__mocks__/utils'; -import { AppContext } from '../../context/App'; import { GroupBy } from '../../types'; import { mockGitHubNotifications } from '../../utils/api/__mocks__/response-mocks'; import * as links from '../../utils/links'; import { AccountNotifications } from './AccountNotifications'; jest.mock('./RepositoryNotifications', () => ({ - RepositoryNotifications: () =>
Repository Notifications
, -})); + RepositoryNotifications: () =>
Repository Notifications
})); describe('renderer/components/notifications/AccountNotifications.tsx', () => { beforeEach(() => { @@ -27,16 +25,11 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { account: mockGitHubCloudAccount, notifications: mockGitHubNotifications, showAccountHeader: true, - error: null, - }; - - const tree = render( - - - , - ); + error: null }; + + const tree = renderWithAppContext(, { + + settings: { ...mockSettings, groupBy: GroupBy.REPOSITORY } }); expect(tree).toMatchSnapshot(); }); @@ -46,16 +39,10 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { account: mockGitHubCloudAccount, notifications: mockGitHubNotifications, showAccountHeader: true, - error: null, - }; - - const tree = render( - - - , - ); + error: null }; + + const tree = renderWithAppContext(, { + settings: { ...mockSettings, groupBy: GroupBy.DATE } }); expect(tree).toMatchSnapshot(); }); @@ -65,17 +52,13 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { account: mockGitHubCloudAccount, notifications: [], showAccountHeader: true, - error: null, - }; + error: null }; - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { - tree = render( - - - , - ); + tree = renderWithAppContext(, { + settings: mockSettings }); }); expect(tree).toMatchSnapshot(); @@ -88,24 +71,16 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { error: { title: 'Error title', descriptions: ['Error description'], - emojis: ['🔥'], - }, - showAccountHeader: true, - }; + emojis: ['🔥'] }, + showAccountHeader: true }; - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { - tree = render( - - - , - ); + tree = renderWithAppContext(, { + + auth: { accounts: [mockGitHubCloudAccount] }, + settings: mockSettings }); }); expect(tree).toMatchSnapshot(); @@ -118,19 +93,14 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { error: { title: 'Error title', descriptions: ['Error description'], - emojis: ['🔥'], - }, - showAccountHeader: true, - }; + emojis: ['🔥'] }, + showAccountHeader: true }; - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { - tree = render( - - - , - ); + tree = renderWithAppContext(, { + auth: mockAuth, settings: mockSettings }); }); expect(tree).toMatchSnapshot(); @@ -145,14 +115,10 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { account: mockGitHubCloudAccount, notifications: [], showAccountHeader: true, - error: null, - }; + error: null }; - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings }); await userEvent.click(screen.getByTestId('account-profile')); @@ -169,14 +135,10 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { account: mockGitHubCloudAccount, notifications: [], showAccountHeader: true, - error: null, - }; + error: null }; - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings }); await userEvent.click(screen.getByTestId('account-issues')); @@ -195,14 +157,10 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { account: mockGitHubCloudAccount, notifications: [], showAccountHeader: true, - error: null, - }; + error: null }; - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings }); await userEvent.click(screen.getByTestId('account-pull-requests')); @@ -217,22 +175,15 @@ describe('renderer/components/notifications/AccountNotifications.tsx', () => { account: mockGitHubCloudAccount, notifications: mockGitHubNotifications, showAccountHeader: true, - error: null, - }; + error: null }; - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings }); await userEvent.click(screen.getByTestId('account-toggle')); - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + settings: mockSettings }); expect(tree).toMatchSnapshot(); }); }); diff --git a/src/renderer/components/notifications/NotificationFooter.test.tsx b/src/renderer/components/notifications/NotificationFooter.test.tsx index f7ee60fa8..57f7df5eb 100644 --- a/src/renderer/components/notifications/NotificationFooter.test.tsx +++ b/src/renderer/components/notifications/NotificationFooter.test.tsx @@ -1,12 +1,9 @@ -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { - mockGitHubCloudAccount, - mockSettings, -} from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; -import { GroupBy, type Link } from '../../types'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; +import { mockGitHubCloudAccount } from '../../__mocks__/state-mocks'; +import type { Link } from '../../types'; import type { UserType } from '../../typesGitHub'; import { mockSingleNotification } from '../../utils/api/__mocks__/response-mocks'; import * as comms from '../../utils/comms'; @@ -19,27 +16,21 @@ describe('renderer/components/notifications/NotificationFooter.tsx', () => { it('should render itself & its children', async () => { jest - .spyOn(global.Date, 'now') + .spyOn(globalThis.Date, 'now') .mockImplementation(() => new Date('2024').valueOf()); const props = { notification: mockSingleNotification, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('should render itself & its children when last_read_at is null', async () => { jest - .spyOn(global.Date, 'now') + .spyOn(globalThis.Date, 'now') .mockImplementation(() => new Date('2024').valueOf()); const mockNotification = mockSingleNotification; @@ -49,11 +40,7 @@ describe('renderer/components/notifications/NotificationFooter.tsx', () => { notification: mockNotification, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); @@ -61,7 +48,7 @@ describe('renderer/components/notifications/NotificationFooter.tsx', () => { describe('security alerts should use github icon for avatar', () => { it('Repository Dependabot Alerts Thread', async () => { jest - .spyOn(global.Date, 'now') + .spyOn(globalThis.Date, 'now') .mockImplementation(() => new Date('2024').valueOf()); const mockNotification = mockSingleNotification; @@ -71,18 +58,14 @@ describe('renderer/components/notifications/NotificationFooter.tsx', () => { notification: mockNotification, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); it('Repository Vulnerability Alert', async () => { jest - .spyOn(global.Date, 'now') + .spyOn(globalThis.Date, 'now') .mockImplementation(() => new Date('2024').valueOf()); const mockNotification = mockSingleNotification; @@ -92,11 +75,7 @@ describe('renderer/components/notifications/NotificationFooter.tsx', () => { notification: mockNotification, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); @@ -104,7 +83,7 @@ describe('renderer/components/notifications/NotificationFooter.tsx', () => { it('should default to known avatar if no user found', async () => { jest - .spyOn(global.Date, 'now') + .spyOn(globalThis.Date, 'now') .mockImplementation(() => new Date('2024').valueOf()); const mockNotification = mockSingleNotification; @@ -114,11 +93,7 @@ describe('renderer/components/notifications/NotificationFooter.tsx', () => { notification: mockNotification, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); @@ -146,15 +121,7 @@ describe('renderer/components/notifications/NotificationFooter.tsx', () => { account: mockGitHubCloudAccount, }; - render( - - - , - ); + renderWithAppContext(); await userEvent.click(screen.getByTestId('view-profile')); diff --git a/src/renderer/components/notifications/NotificationHeader.test.tsx b/src/renderer/components/notifications/NotificationHeader.test.tsx index 712977216..450db5006 100644 --- a/src/renderer/components/notifications/NotificationHeader.test.tsx +++ b/src/renderer/components/notifications/NotificationHeader.test.tsx @@ -1,8 +1,8 @@ -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { GroupBy } from '../../types'; import { mockSingleNotification } from '../../utils/api/__mocks__/response-mocks'; import * as comms from '../../utils/comms'; @@ -15,16 +15,11 @@ describe('renderer/components/notifications/NotificationHeader.tsx', () => { it('should render itself & its children - group by repositories', async () => { const props = { - notification: mockSingleNotification, - }; - - const tree = render( - - - , - ); + notification: mockSingleNotification }; + + const tree = renderWithAppContext(, { + + settings: { ...mockSettings, groupBy: GroupBy.REPOSITORY } }); expect(tree).toMatchSnapshot(); }); @@ -32,38 +27,24 @@ describe('renderer/components/notifications/NotificationHeader.tsx', () => { describe('should render itself & its children - group by date', () => { it('with notification number', async () => { const props = { - notification: mockSingleNotification, - }; + notification: mockSingleNotification }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + settings: { ...mockSettings, groupBy: GroupBy.DATE } }); expect(tree).toMatchSnapshot(); }); it('with showNumber setting disabled', async () => { const props = { - notification: mockSingleNotification, - }; - - const tree = render( - - - , - ); + notification: mockSingleNotification }; + + const tree = renderWithAppContext(, { + + settings: { + ...mockSettings, + showNumber: false, + groupBy: GroupBy.DATE } }); expect(tree).toMatchSnapshot(); }); @@ -72,17 +53,10 @@ describe('renderer/components/notifications/NotificationHeader.tsx', () => { const props = { notification: { ...mockSingleNotification, - subject: { ...mockSingleNotification.subject, number: null }, - }, - }; - - const tree = render( - - - , - ); + subject: { ...mockSingleNotification.subject, number: null } } }; + + const tree = renderWithAppContext(, { + settings: { ...mockSettings, groupBy: GroupBy.DATE } }); expect(tree).toMatchSnapshot(); }); @@ -94,16 +68,10 @@ describe('renderer/components/notifications/NotificationHeader.tsx', () => { .mockImplementation(); const props = { - notification: mockSingleNotification, - }; - - render( - - - , - ); + notification: mockSingleNotification }; + + renderWithAppContext(, { + settings: { ...mockSettings, groupBy: GroupBy.DATE } }); await userEvent.click(screen.getByTestId('view-repository')); diff --git a/src/renderer/components/notifications/NotificationRow.test.tsx b/src/renderer/components/notifications/NotificationRow.test.tsx index 2feb18a85..7031c6371 100644 --- a/src/renderer/components/notifications/NotificationRow.test.tsx +++ b/src/renderer/components/notifications/NotificationRow.test.tsx @@ -1,12 +1,12 @@ -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAuth, mockGitHubCloudAccount, mockSettings, } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { GroupBy } from '../../types'; import { mockSingleNotification } from '../../utils/api/__mocks__/response-mocks'; import * as comms from '../../utils/comms'; @@ -23,7 +23,7 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { it('should render itself & its children - group by date', async () => { jest - .spyOn(global.Date, 'now') + .spyOn(globalThis.Date, 'now') .mockImplementation(() => new Date('2024').valueOf()); const props = { @@ -31,20 +31,16 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + settings: { ...mockSettings, groupBy: GroupBy.DATE }, + }); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - group by repositories', async () => { jest - .spyOn(global.Date, 'now') + .spyOn(globalThis.Date, 'now') .mockImplementation(() => new Date('2024').valueOf()); const props = { @@ -52,20 +48,16 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + settings: { ...mockSettings, groupBy: GroupBy.REPOSITORY }, + }); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - hide numbers', async () => { jest - .spyOn(global.Date, 'now') + .spyOn(globalThis.Date, 'now') .mockImplementation(() => new Date('2024').valueOf()); const props = { @@ -73,13 +65,9 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + settings: { ...mockSettings, showNumber: false }, + }); expect(tree).toMatchSnapshot(); }); @@ -97,11 +85,7 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - const tree = render( - - - , - ); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); @@ -115,17 +99,11 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - render( - - - , - ); + renderWithAppContext(, { + settings: { ...mockSettings, markAsDoneOnOpen: false }, + markNotificationsAsRead, + auth: mockAuth, + }); await userEvent.click(screen.getByTestId('notification-row')); @@ -141,21 +119,15 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - render( - - - , - ); + renderWithAppContext(, { + settings: { + ...mockSettings, + markAsDoneOnOpen: false, + delayNotificationState: true, + }, + markNotificationsAsRead, + auth: mockAuth, + }); await userEvent.click(screen.getByTestId('notification-row')); @@ -171,17 +143,11 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - render( - - - , - ); + renderWithAppContext(, { + settings: { ...mockSettings, markAsDoneOnOpen: true }, + markNotificationsAsDone, + auth: mockAuth, + }); await userEvent.click(screen.getByTestId('notification-row')); @@ -197,16 +163,10 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - render( - - - , - ); + renderWithAppContext(, { + settings: { ...mockSettings, markAsDoneOnOpen: false }, + markNotificationsAsRead, + }); await userEvent.click(screen.getByTestId('notification-mark-as-read')); @@ -221,13 +181,10 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - render( - - - , - ); + renderWithAppContext(, { + settings: mockSettings, + markNotificationsAsDone, + }); await userEvent.click(screen.getByTestId('notification-mark-as-done')); @@ -242,15 +199,10 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => { account: mockGitHubCloudAccount, }; - render( - - - - - , - ); + renderWithAppContext(, { + settings: mockSettings, + unsubscribeNotification, + }); await userEvent.click( screen.getByTestId('notification-unsubscribe-from-thread'), diff --git a/src/renderer/components/notifications/RepositoryNotifications.test.tsx b/src/renderer/components/notifications/RepositoryNotifications.test.tsx index bd352b37e..8aa0630f9 100644 --- a/src/renderer/components/notifications/RepositoryNotifications.test.tsx +++ b/src/renderer/components/notifications/RepositoryNotifications.test.tsx @@ -1,19 +1,17 @@ -import { act, render, screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockGitHubCloudAccount, - mockSettings, -} from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; + mockSettings } from '../../__mocks__/state-mocks'; import type { Link } from '../../types'; import { mockGitHubNotifications } from '../../utils/api/__mocks__/response-mocks'; import * as comms from '../../utils/comms'; import { RepositoryNotifications } from './RepositoryNotifications'; jest.mock('./NotificationRow', () => ({ - NotificationRow: () =>
NotificationRow
, -})); + NotificationRow: () =>
NotificationRow
})); describe('renderer/components/notifications/RepositoryNotifications.tsx', () => { const markNotificationsAsRead = jest.fn(); @@ -22,19 +20,15 @@ describe('renderer/components/notifications/RepositoryNotifications.tsx', () => const props = { account: mockGitHubCloudAccount, repoName: 'gitify-app/notifications-test', - repoNotifications: mockGitHubNotifications, - }; + repoNotifications: mockGitHubNotifications }; afterEach(() => { jest.clearAllMocks(); }); it('should render itself & its children', () => { - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + }); expect(tree).toMatchSnapshot(); }); @@ -44,11 +38,8 @@ describe('renderer/components/notifications/RepositoryNotifications.tsx', () => n.unread = false; } - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + }); expect(tree).toMatchSnapshot(); }); @@ -58,11 +49,8 @@ describe('renderer/components/notifications/RepositoryNotifications.tsx', () => .spyOn(comms, 'openExternalLink') .mockImplementation(); - render( - - - , - ); + renderWithAppContext(, { + }); await userEvent.click(screen.getByTestId('open-repository')); @@ -73,13 +61,8 @@ describe('renderer/components/notifications/RepositoryNotifications.tsx', () => }); it('should mark a repo as read', async () => { - render( - - - , - ); + renderWithAppContext(, { + settings: { ...mockSettings }, markNotificationsAsRead }); await userEvent.click(screen.getByTestId('repository-mark-as-read')); @@ -89,13 +72,8 @@ describe('renderer/components/notifications/RepositoryNotifications.tsx', () => }); it('should mark a repo as done', async () => { - render( - - - , - ); + renderWithAppContext(, { + settings: { ...mockSettings }, markNotificationsAsDone }); await userEvent.click(screen.getByTestId('repository-mark-as-done')); @@ -107,23 +85,20 @@ describe('renderer/components/notifications/RepositoryNotifications.tsx', () => it('should use default repository icon when avatar is not available', () => { props.repoNotifications[0].repository.owner.avatar_url = '' as Link; - const tree = render( - - - , - ); + const tree = renderWithAppContext(, { + }); expect(tree).toMatchSnapshot(); }); it('should toggle repository notifications visibility', async () => { await act(async () => { - render(); + renderWithAppContext(); }); await userEvent.click(screen.getByTestId('repository-toggle')); - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); }); diff --git a/src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap b/src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap index 75dafb55a..6989e7d7b 100644 --- a/src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap +++ b/src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap @@ -6,471 +6,493 @@ exports[`renderer/components/notifications/AccountNotifications.tsx should rende "baseElement":
-
-
+ + +
+
-
- 🔥 -
-
- Error title -
-
-
- Error description -
-
- - - , - "container":
-
+ , + "container":
-
- 🔥 -
-
- Error title + + +
+ octocat +
+ @octocat +
+
+
+ + + +  ( + 0 + ) + + +
+ +
- Error description +
+
+
+ 🔥 +
+
+ Error title +
+
+
+ Error description +
+
@@ -535,472 +557,494 @@ exports[`renderer/components/notifications/AccountNotifications.tsx should rende "baseElement":
+
+
+
+
+ 🔥 +
+
+ Error title +
+
+
+ Error description +
+
+
+
+
+
+ , + "container":
+
+
+
-
-
-
- 🔥 -
-
- Error title -
-
-
- Error description -
-
-
-
- , - "container":
- -
-
-
-
- 🔥 -
-
- Error title + Error description +
-
- Error description -
, @@ -1064,263 +1108,42 @@ exports[`renderer/components/notifications/AccountNotifications.tsx should rende "baseElement":
-
-
- -
-
-
- -
-
-
+ + + + +  ( + 2 + ) + + + +
- - I am a robot and this is a test! - -
+
+
+
- - Updated - - - May 20, 2017 - -
-
-
- - - 1 - +
+ gitify-app/notifications-test +
+ gitify-app/notifications-test +
+
+ +
- - -
+
+ + I am a robot and this is a test! + +
+
+ +
- - 1 + Updated + + May 20, 2017 +
- -
-
-
-
-
- - - -
-
-
-
- - -
-
-
- -
+
- - Improve the UI - -
+
+
-
-
+ +
- - Authored - - - May 20, 2017 - -
-
-
-
-
-
- - - -
-
-
- , - "container":
- +
+ + Improve the UI + +
+
+
+ +
+
+ + Authored + + + May 20, 2017 + +
+
+
+
+
- octocat -
- @octocat -
+ + + +
- - - - -  ( - 2 - ) - - - - - +
+ , + "container":
- -
-
-
- -
-
-
-
- - I am a robot and this is a test! + + + + +  ( + 2 + ) + + -
+
+ + +
+
+
+
+ +
- - Updated - - - May 20, 2017 - -
-
-
- - - 1 - +
+ gitify-app/notifications-test +
+ gitify-app/notifications-test +
+
+ +
- - +
+ + I am a robot and this is a test! + +
+
+
- - 1 + Updated + + May 20, 2017 +
- -
-
-
-
-
- - - -
-
-
-
- - -
-
-
- -
+
- - Improve the UI - -
+
+
-
-
+ +
- - Authored - - + +
+
+
+
- May 20, 2017 - + + Improve the UI + +
+
+
+ +
+
+ + Authored + + + May 20, 2017 + +
+
+
-
-
-
-
- - - + + + +
+
, @@ -2819,382 +2885,404 @@ exports[`renderer/components/notifications/AccountNotifications.tsx should rende "baseElement":
+
+
+ Repository Notifications +
+
+
+
+ , + "container":
+
+
-
-
- Repository Notifications -
-
- , - "container":
- +
+ Repository Notifications +
-
- Repository Notifications -
, "debug": [Function], "findAllByAltText": [Function], @@ -3256,460 +3344,482 @@ exports[`renderer/components/notifications/AccountNotifications.tsx should rende "baseElement":
+
-
- octocat
- @octocat + 🎊 +
+
+ No new notifications
-
- - - -  ( - 0 - ) - - - - +
+
+ + + + , + "container":
+
+
-
-
-
-
- 🎊 -
-
- No new notifications -
-
-
-
-
- , - "container":
- -
-
+ + +
+
- 🎊 -
-
- No new notifications +
+
+ 🎊 +
+
+ No new notifications +
+
@@ -3775,568 +3885,601 @@ exports[`renderer/components/notifications/AccountNotifications.tsx should toggl "baseElement":
+
+
+ +
+
+
+ +
+
+ Repository Notifications +
+
+
+ + , + "container":
+
+
-
-
-
- -
- Repository Notifications -
-
- , - "container":
- +
+ Repository Notifications +
-
- Repository Notifications -
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/notifications/__snapshots__/NotificationFooter.test.tsx.snap b/src/renderer/components/notifications/__snapshots__/NotificationFooter.test.tsx.snap index ba7b41aa4..0fd0f5a3d 100644 --- a/src/renderer/components/notifications/__snapshots__/NotificationFooter.test.tsx.snap +++ b/src/renderer/components/notifications/__snapshots__/NotificationFooter.test.tsx.snap @@ -6,280 +6,302 @@ exports[`renderer/components/notifications/NotificationFooter.tsx security alert "baseElement":
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
, "container":
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
, @@ -343,280 +365,302 @@ exports[`renderer/components/notifications/NotificationFooter.tsx security alert "baseElement":
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
, "container":
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
, @@ -680,282 +724,304 @@ exports[`renderer/components/notifications/NotificationFooter.tsx should default "baseElement":
- -
-
- - Updated - - - May 20, 2017 - -
-
-
- - 1 -
-
-
- + Updated + + + May 20, 2017 + +
+
+ +
+ + + 1 + +
+
- 1 +
+ + + 1 + +
-
+
, "container":
- -
-
- - Updated - - - May 20, 2017 - -
-
-
- - 1 -
-
-
- + Updated + + + May 20, 2017 + +
+
- 1 +
+ + + 1 + +
+
+ +
+ + + 1 + +
-
+
, @@ -1019,280 +1085,302 @@ exports[`renderer/components/notifications/NotificationFooter.tsx should render "baseElement":
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
, "container":
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
, @@ -1356,280 +1444,302 @@ exports[`renderer/components/notifications/NotificationFooter.tsx should render "baseElement":
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
, "container":
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
, diff --git a/src/renderer/components/notifications/__snapshots__/NotificationHeader.test.tsx.snap b/src/renderer/components/notifications/__snapshots__/NotificationHeader.test.tsx.snap index b8f897c1f..8a531806d 100644 --- a/src/renderer/components/notifications/__snapshots__/NotificationHeader.test.tsx.snap +++ b/src/renderer/components/notifications/__snapshots__/NotificationHeader.test.tsx.snap @@ -6,22 +6,16 @@ exports[`renderer/components/notifications/NotificationHeader.tsx should render "baseElement":
- +
- -
+
, "container":
- +
- -
+
, @@ -173,22 +195,16 @@ exports[`renderer/components/notifications/NotificationHeader.tsx should render "baseElement":
- + - -
, "container":
- + - -
, @@ -340,22 +384,16 @@ exports[`renderer/components/notifications/NotificationHeader.tsx should render "baseElement":
- +
- -
+
, "container":
- +
- -
+
, @@ -505,9 +571,31 @@ exports[`renderer/components/notifications/NotificationHeader.tsx should render { "asFragment": [Function], "baseElement": -
+
+
+
+
+
, - "container":
, + "container":
+
+
+
+
, "debug": [Function], "findAllByAltText": [Function], "findAllByDisplayValue": [Function], diff --git a/src/renderer/components/notifications/__snapshots__/NotificationRow.test.tsx.snap b/src/renderer/components/notifications/__snapshots__/NotificationRow.test.tsx.snap index abcb9ff5c..331b81ab3 100644 --- a/src/renderer/components/notifications/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/renderer/components/notifications/__snapshots__/NotificationRow.test.tsx.snap @@ -6,79 +6,73 @@ exports[`renderer/components/notifications/NotificationRow.tsx should render its "baseElement":
- -
+ +
- +
- -
-
-
-
- - I am a robot and this is a test! - -
-
-
- gitify-app + I am a robot and this is a test! + +
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
-
-
-
- - - -
-
-
- , - "container":
-
-
- - -
-
+ + -
+
+
+
+ , + "container":
+
+
+
- - I am a robot and this is a test! - -
-
+
- - Updated - - - May 20, 2017 - -
-
-
- - - 1 - +
+ gitify-app/notifications-test +
+ gitify-app/notifications-test +
+
+ +
- - +
+ + I am a robot and this is a test! + +
+
+
- + Updated + + + May 20, 2017 + +
+
+ +
+ + + 1 + +
+
- 1 +
+ + + 1 + +
- +
-
-
-
- - - + + + +
+
, @@ -807,640 +829,662 @@ exports[`renderer/components/notifications/NotificationRow.tsx should render its "baseElement":
- -
- - I am a robot and this is a test! - - -
-
+
- - Updated - - - May 20, 2017 - -
-
- + I am a robot and this is a test! + + +
+
+
- - 1 + Updated + + May 20, 2017 +
- -
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
-
-
-
- - - + + + +
+
, "container":
- -
- - I am a robot and this is a test! - - -
-
+
- - Updated - - - May 20, 2017 - -
-
- + I am a robot and this is a test! + + +
+
+
- - 1 + Updated + + May 20, 2017 +
- -
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
-
-
-
- - - + + + +
+
, @@ -1504,640 +1548,662 @@ exports[`renderer/components/notifications/NotificationRow.tsx should render its "baseElement":
- -
- - I am a robot and this is a test! - -
-
+ +
+
+ + I am a robot and this is a test! + +
- gitify-app -
- -
- - Updated - - - May 20, 2017 - -
-
- +
- - 1 + Updated + + May 20, 2017 +
-
-
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
-
-
-
- - - + + + +
+
, "container":
- -
- - I am a robot and this is a test! - -
-
+
- - Updated - - - May 20, 2017 - -
-
- + I am a robot and this is a test! + +
+
+
- - 1 + Updated + + May 20, 2017 +
- -
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
-
-
-
- - - + + + +
+
, @@ -2196,645 +2262,667 @@ exports[`renderer/components/notifications/NotificationRow.tsx should render its `; exports[`renderer/components/notifications/NotificationRow.tsx should render itself & its children - notification is read 1`] = ` -{ - "asFragment": [Function], - "baseElement": -
-
-
- - -
-
- - I am a robot and this is a test! - - -
+{ + "asFragment": [Function], + "baseElement": +
+
+
+
+
- - Updated - - - May 20, 2017 - -
-
- + I am a robot and this is a test! + + +
+
+
- - 1 + Updated + + May 20, 2017 +
- -
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
-
-
-
- - - + + + +
+
, "container":
- -
- - I am a robot and this is a test! - - -
-
+
- - Updated - - - May 20, 2017 - -
-
- + I am a robot and this is a test! + + +
+
+
- - 1 + Updated + + May 20, 2017 +
- -
- +
+ + + 1 + +
+ - 1 +
+ + + 1 + +
-
+
-
-
-
- - - + + + +
+
, diff --git a/src/renderer/components/notifications/__snapshots__/RepositoryNotifications.test.tsx.snap b/src/renderer/components/notifications/__snapshots__/RepositoryNotifications.test.tsx.snap index 418d22b09..37c845653 100644 --- a/src/renderer/components/notifications/__snapshots__/RepositoryNotifications.test.tsx.snap +++ b/src/renderer/components/notifications/__snapshots__/RepositoryNotifications.test.tsx.snap @@ -6,382 +6,404 @@ exports[`renderer/components/notifications/RepositoryNotifications.tsx should re "baseElement":
-
+ + + + +  ( + 2 + ) + + + + +
- -
+
+
+ NotificationRow +
+
+ NotificationRow +
+ + + + , + "container":
+
+
- - -
-
-
- NotificationRow -
-
- NotificationRow -
-
- , - "container":
-
- + + -
- - - + + +
+
+
+ NotificationRow +
+
+ NotificationRow +
-
- NotificationRow -
-
- NotificationRow -
, "debug": [Function], "findAllByAltText": [Function], @@ -443,382 +465,404 @@ exports[`renderer/components/notifications/RepositoryNotifications.tsx should re "baseElement":
-
+ + + + +  ( + 2 + ) + + + + +
- -
+
+
+ NotificationRow +
+
+ NotificationRow +
+ + + + , + "container":
+
+
- - -
-
-
- NotificationRow -
-
- NotificationRow -
-
- , - "container":
-
- + + -
- - - + + +
+
+
+ NotificationRow +
+
+ NotificationRow +
-
- NotificationRow -
-
- NotificationRow -
, "debug": [Function], "findAllByAltText": [Function], @@ -880,586 +924,619 @@ exports[`renderer/components/notifications/RepositoryNotifications.tsx should to "baseElement":
- +
+
- - -
- +
+
- - -
+
+
+ NotificationRow +
+
+ NotificationRow +
+ + + + , + "container":
+
+
- - -
-
-
- NotificationRow -
-
- NotificationRow -
-
- , - "container":
-
- + -
- - - + + +
+
+
+ NotificationRow +
+
+ NotificationRow +
-
- NotificationRow -
-
- NotificationRow -
, "debug": [Function], "findAllByAltText": [Function], @@ -1521,396 +1598,418 @@ exports[`renderer/components/notifications/RepositoryNotifications.tsx should us "baseElement":
- +
+
- - -
+
+
+ NotificationRow +
+
+ NotificationRow +
+ + + + , + "container":
+
+
- - -
-
-
- NotificationRow -
-
- NotificationRow -
-
- , - "container":
-
- + -
- - - + + +
+
+
+ NotificationRow +
+
+ NotificationRow +
-
- NotificationRow -
-
- NotificationRow -
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/primitives/CustomCounter.test.tsx b/src/renderer/components/primitives/CustomCounter.test.tsx index d477615c5..3533ca63d 100644 --- a/src/renderer/components/primitives/CustomCounter.test.tsx +++ b/src/renderer/components/primitives/CustomCounter.test.tsx @@ -1,10 +1,9 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { CustomCounter } from './CustomCounter'; describe('renderer/components/primitives/CustomCounter.tsx', () => { it('should render itself & its children', () => { - const tree = render(); + const tree = renderWithAppContext(); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/primitives/EmojiText.test.tsx b/src/renderer/components/primitives/EmojiText.test.tsx index 4a374c56b..3d1186fe7 100644 --- a/src/renderer/components/primitives/EmojiText.test.tsx +++ b/src/renderer/components/primitives/EmojiText.test.tsx @@ -1,5 +1,6 @@ -import { act, render } from '@testing-library/react'; +import { act } from '@testing-library/react'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { EmojiText, type IEmojiText } from './EmojiText'; describe('renderer/components/primitives/EmojiText.tsx', () => { @@ -8,10 +9,10 @@ describe('renderer/components/primitives/EmojiText.tsx', () => { text: '🍺', }; - let tree: ReturnType | null = null; + let tree: ReturnType | null = null; await act(async () => { - tree = render(); + tree = renderWithAppContext(); }); expect(tree).toMatchSnapshot(); diff --git a/src/renderer/components/primitives/Footer.test.tsx b/src/renderer/components/primitives/Footer.test.tsx index e932c704e..6f8cb1fa4 100644 --- a/src/renderer/components/primitives/Footer.test.tsx +++ b/src/renderer/components/primitives/Footer.test.tsx @@ -1,16 +1,17 @@ -import { render } from '@testing-library/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { Footer } from './Footer'; describe('renderer/components/primitives/Footer.tsx', () => { it('should render itself & its children - space-between', () => { - const tree = render(
Test
); + const tree = renderWithAppContext( +
Test
, + ); expect(tree).toMatchSnapshot(); }); it('should render itself & its children - end', () => { - const tree = render(
Test
); + const tree = renderWithAppContext(
Test
); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/primitives/Header.test.tsx b/src/renderer/components/primitives/Header.test.tsx index bc90e3d57..df5a17c68 100644 --- a/src/renderer/components/primitives/Header.test.tsx +++ b/src/renderer/components/primitives/Header.test.tsx @@ -1,16 +1,15 @@ -import { render, screen } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { MarkGithubIcon } from '@primer/octicons-react'; -import { AppContext } from '../../context/App'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { Header } from './Header'; const mockNavigate = jest.fn(); jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), - useNavigate: () => mockNavigate, -})); + useNavigate: () => mockNavigate })); describe('renderer/components/primitives/Header.tsx', () => { const fetchNotifications = jest.fn(); @@ -20,13 +19,15 @@ describe('renderer/components/primitives/Header.tsx', () => { }); it('should render itself & its children', () => { - const tree = render(
Test Header
); + const tree = renderWithAppContext( +
Test Header
, + ); expect(tree).toMatchSnapshot(); }); it('should navigate back', async () => { - render(
Test Header
); + renderWithAppContext(
Test Header
); await userEvent.click(screen.getByTestId('header-nav-back')); @@ -34,16 +35,11 @@ describe('renderer/components/primitives/Header.tsx', () => { }); it('should navigate back and fetch notifications', async () => { - render( - -
- Test Header -
-
, + renderWithAppContext( +
+ Test Header +
, + { fetchNotifications }, ); await userEvent.click(screen.getByTestId('header-nav-back')); diff --git a/src/renderer/components/primitives/HoverButton.test.tsx b/src/renderer/components/primitives/HoverButton.test.tsx index adc447273..3956da573 100644 --- a/src/renderer/components/primitives/HoverButton.test.tsx +++ b/src/renderer/components/primitives/HoverButton.test.tsx @@ -1,14 +1,13 @@ -import { render } from '@testing-library/react'; - import { MarkGithubIcon } from '@primer/octicons-react'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { HoverButton } from './HoverButton'; describe('renderer/components/primitives/HoverButton.tsx', () => { it('should render', () => { const mockAction = jest.fn(); - const tree = render( + const tree = renderWithAppContext( { it('should render - disabled', () => { const mockAction = jest.fn(); - const tree = render( + const tree = renderWithAppContext( { it('should render', () => { - const tree = render( + const tree = renderWithAppContext( Hover Group , diff --git a/src/renderer/components/primitives/Title.test.tsx b/src/renderer/components/primitives/Title.test.tsx index b134bc91e..eb0b7b2d7 100644 --- a/src/renderer/components/primitives/Title.test.tsx +++ b/src/renderer/components/primitives/Title.test.tsx @@ -1,18 +1,19 @@ -import { render } from '@testing-library/react'; - import { PersonFillIcon } from '@primer/octicons-react'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { Title } from './Title'; describe('renderer/routes/components/primitives/Title.tsx', () => { it('should render the title - default size', async () => { - const { container } = render(Legend); + const { container } = renderWithAppContext( + Legend, + ); expect(container).toMatchSnapshot(); }); it('should render the title - specific size', async () => { - const { container } = render( + const { container } = renderWithAppContext( Legend , diff --git a/src/renderer/components/primitives/__snapshots__/CustomCounter.test.tsx.snap b/src/renderer/components/primitives/__snapshots__/CustomCounter.test.tsx.snap index e886442b1..97e8c2405 100644 --- a/src/renderer/components/primitives/__snapshots__/CustomCounter.test.tsx.snap +++ b/src/renderer/components/primitives/__snapshots__/CustomCounter.test.tsx.snap @@ -5,19 +5,41 @@ exports[`renderer/components/primitives/CustomCounter.tsx should render itself & "asFragment": [Function], "baseElement":
- - 100 - +
+ + 100 + +
+
, "container":
- - 100 - +
+ + 100 + +
+
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/primitives/__snapshots__/EmojiText.test.tsx.snap b/src/renderer/components/primitives/__snapshots__/EmojiText.test.tsx.snap index 9474fc8e9..1f1db6f7c 100644 --- a/src/renderer/components/primitives/__snapshots__/EmojiText.test.tsx.snap +++ b/src/renderer/components/primitives/__snapshots__/EmojiText.test.tsx.snap @@ -6,27 +6,49 @@ exports[`renderer/components/primitives/EmojiText.tsx should render 1`] = ` "baseElement":
- 🍺 +
+
+ 🍺 +
+
, "container":
- 🍺 +
+
+ 🍺 +
+
, "debug": [Function], diff --git a/src/renderer/components/primitives/__snapshots__/Footer.test.tsx.snap b/src/renderer/components/primitives/__snapshots__/Footer.test.tsx.snap index d2f027b24..9cfa61637 100644 --- a/src/renderer/components/primitives/__snapshots__/Footer.test.tsx.snap +++ b/src/renderer/components/primitives/__snapshots__/Footer.test.tsx.snap @@ -6,34 +6,56 @@ exports[`renderer/components/primitives/Footer.tsx should render itself & its ch "baseElement":
, "container":
, @@ -97,34 +119,56 @@ exports[`renderer/components/primitives/Footer.tsx should render itself & its ch "baseElement":
, "container":
, diff --git a/src/renderer/components/primitives/__snapshots__/Header.test.tsx.snap b/src/renderer/components/primitives/__snapshots__/Header.test.tsx.snap index 8c8ad8ee9..9b8488282 100644 --- a/src/renderer/components/primitives/__snapshots__/Header.test.tsx.snap +++ b/src/renderer/components/primitives/__snapshots__/Header.test.tsx.snap @@ -6,62 +6,40 @@ exports[`renderer/components/primitives/Header.tsx should render itself & its ch "baseElement":
- -
-
-

+ +
- Test Header -

-
+
+ +

+ Test Header +

+
+
+
- +
, "container":
- -
-
-

+ +
- Test Header -

-
+
+ +

+ Test Header +

+
+
+
- +
, diff --git a/src/renderer/components/primitives/__snapshots__/HoverButton.test.tsx.snap b/src/renderer/components/primitives/__snapshots__/HoverButton.test.tsx.snap index 2f8faf61f..fa46e4d70 100644 --- a/src/renderer/components/primitives/__snapshots__/HoverButton.test.tsx.snap +++ b/src/renderer/components/primitives/__snapshots__/HoverButton.test.tsx.snap @@ -4,9 +4,31 @@ exports[`renderer/components/primitives/HoverButton.tsx should render - disabled { "asFragment": [Function], "baseElement": -
+
+
+
+
+
, - "container":
, + "container":
+
+
+
+
, "debug": [Function], "findAllByAltText": [Function], "findAllByDisplayValue": [Function], @@ -66,69 +88,91 @@ exports[`renderer/components/primitives/HoverButton.tsx should render 1`] = ` "asFragment": [Function], "baseElement":
- + +
+
, "container":
- + +
+
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/components/primitives/__snapshots__/HoverGroup.test.tsx.snap b/src/renderer/components/primitives/__snapshots__/HoverGroup.test.tsx.snap index 9b64288f0..1fcf38d90 100644 --- a/src/renderer/components/primitives/__snapshots__/HoverGroup.test.tsx.snap +++ b/src/renderer/components/primitives/__snapshots__/HoverGroup.test.tsx.snap @@ -6,29 +6,51 @@ exports[`renderer/components/primitives/HoverGroup.tsx should render 1`] = ` "baseElement":
- Hover Group +
+
+ Hover Group +
+
, "container":
- Hover Group +
+
+ Hover Group +
+
, "debug": [Function], diff --git a/src/renderer/components/primitives/__snapshots__/Title.test.tsx.snap b/src/renderer/components/primitives/__snapshots__/Title.test.tsx.snap index 6eb907e2d..69ed7dc05 100644 --- a/src/renderer/components/primitives/__snapshots__/Title.test.tsx.snap +++ b/src/renderer/components/primitives/__snapshots__/Title.test.tsx.snap @@ -2,86 +2,108 @@ exports[`renderer/routes/components/primitives/Title.tsx should render the title - default size 1`] = `
- +
-
-
- - -

- Legend -

-
+
+ +

+ Legend +

+
+
+
- +
`; exports[`renderer/routes/components/primitives/Title.tsx should render the title - specific size 1`] = `
- +
-
- -

+
- Legend -

-
+
+ +

+ Legend +

+
+
+
-
+
`; diff --git a/src/renderer/components/settings/AppearanceSettings.test.tsx b/src/renderer/components/settings/AppearanceSettings.test.tsx index 9aa4eacd7..72191fdf9 100644 --- a/src/renderer/components/settings/AppearanceSettings.test.tsx +++ b/src/renderer/components/settings/AppearanceSettings.test.tsx @@ -1,12 +1,11 @@ -import { act, fireEvent, render, screen } from '@testing-library/react'; +import { act, fireEvent, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAuth, mockGitHubAppAccount, - mockSettings, -} from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; + mockSettings } from '../../__mocks__/state-mocks'; import { AppearanceSettings } from './AppearanceSettings'; describe('renderer/components/settings/AppearanceSettings.tsx', () => { @@ -19,17 +18,11 @@ describe('renderer/components/settings/AppearanceSettings.tsx', () => { it('should change the theme mode dropdown', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.selectOptions( @@ -43,19 +36,12 @@ describe('renderer/components/settings/AppearanceSettings.tsx', () => { it('should toggle increase contrast checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: { + accounts: [mockGitHubAppAccount] }, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-increaseContrast')); @@ -68,17 +54,11 @@ describe('renderer/components/settings/AppearanceSettings.tsx', () => { window.gitify.zoom.getLevel = jest.fn().mockReturnValue(-1); await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); fireEvent(window, new Event('resize')); @@ -96,17 +76,11 @@ describe('renderer/components/settings/AppearanceSettings.tsx', () => { }); await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); // Zoom Out @@ -147,19 +121,12 @@ describe('renderer/components/settings/AppearanceSettings.tsx', () => { it('should toggle account header checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: { + accounts: [mockGitHubAppAccount] }, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-showAccountHeader')); @@ -170,19 +137,12 @@ describe('renderer/components/settings/AppearanceSettings.tsx', () => { it('should toggle wrap notification title checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: { + accounts: [mockGitHubAppAccount] }, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-wrapNotificationTitle')); diff --git a/src/renderer/components/settings/NotificationSettings.test.tsx b/src/renderer/components/settings/NotificationSettings.test.tsx index e7e8a1ba3..4e69390e6 100644 --- a/src/renderer/components/settings/NotificationSettings.test.tsx +++ b/src/renderer/components/settings/NotificationSettings.test.tsx @@ -1,11 +1,9 @@ -import { act, render, screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { BaseStyles, ThemeProvider } from '@primer/react'; - +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAuth, mockSettings } from '../../__mocks__/state-mocks'; import { Constants } from '../../constants'; -import { AppContext } from '../../context/App'; import * as comms from '../../utils/comms'; import { NotificationSettings } from './NotificationSettings'; @@ -18,17 +16,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should change the groupBy radio group', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('radio-groupBy-date')); @@ -39,17 +31,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should change the fetchType radio group', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('radio-fetchType-inactivity')); @@ -61,17 +47,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { describe('fetch interval settings', () => { it('should update the fetch interval values when using the buttons', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); // Increase fetch interval @@ -128,22 +108,15 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should prevent going lower than minimum interval', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: { + ...mockSettings, + fetchInterval: + Constants.MIN_FETCH_NOTIFICATIONS_INTERVAL_MS + + Constants.FETCH_NOTIFICATIONS_INTERVAL_STEP_MS }, + updateSetting }); }); await act(async () => { @@ -171,22 +144,15 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should prevent going above maximum interval', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: { + ...mockSettings, + fetchInterval: + Constants.MAX_FETCH_NOTIFICATIONS_INTERVAL_MS - + Constants.FETCH_NOTIFICATIONS_INTERVAL_STEP_MS }, + updateSetting }); }); await act(async () => { @@ -215,17 +181,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should toggle the fetchAllNotifications checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-fetchAllNotifications')); @@ -236,17 +196,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should toggle detailed notifications checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-detailedNotifications')); @@ -257,17 +211,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should toggle metric pills checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-showPills')); @@ -278,17 +226,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should toggle show number checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-showNumber')); @@ -299,17 +241,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should toggle the showOnlyParticipating checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-showOnlyParticipating')); @@ -324,21 +260,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { .mockImplementation(); await act(async () => { - render( - - - - - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); const tooltipElement = screen.getByLabelText( @@ -360,17 +286,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should toggle the markAsDoneOnOpen checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-markAsDoneOnOpen')); @@ -381,17 +301,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should toggle the markAsDoneOnUnsubscribe checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click( @@ -404,17 +318,11 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => { it('should toggle the delayNotificationState checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click( diff --git a/src/renderer/components/settings/SettingsFooter.test.tsx b/src/renderer/components/settings/SettingsFooter.test.tsx index 4fec2ae51..255f01302 100644 --- a/src/renderer/components/settings/SettingsFooter.test.tsx +++ b/src/renderer/components/settings/SettingsFooter.test.tsx @@ -1,8 +1,7 @@ -import { act, render, screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { mockAuth, mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import * as comms from '../../utils/comms'; import { SettingsFooter } from './SettingsFooter'; @@ -27,16 +26,7 @@ describe('renderer/components/settings/SettingsFooter.tsx', () => { it('should show app version', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(); }); expect(screen.getByTestId('settings-release-notes')).toMatchSnapshot(); @@ -48,16 +38,7 @@ describe('renderer/components/settings/SettingsFooter.tsx', () => { .mockImplementation(); await act(async () => { - render( - - - , - ); + renderWithAppContext(); }); await userEvent.click(screen.getByTestId('settings-release-notes')); @@ -70,16 +51,7 @@ describe('renderer/components/settings/SettingsFooter.tsx', () => { it('should open account management', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(); }); await userEvent.click(screen.getByTestId('settings-accounts')); @@ -91,16 +63,7 @@ describe('renderer/components/settings/SettingsFooter.tsx', () => { const quitAppMock = jest.spyOn(comms, 'quitApp'); await act(async () => { - render( - - - , - ); + renderWithAppContext(); }); await userEvent.click(screen.getByTestId('settings-quit')); diff --git a/src/renderer/components/settings/SettingsReset.test.tsx b/src/renderer/components/settings/SettingsReset.test.tsx index ef058dc2b..b887903ef 100644 --- a/src/renderer/components/settings/SettingsReset.test.tsx +++ b/src/renderer/components/settings/SettingsReset.test.tsx @@ -1,8 +1,8 @@ -import { act, render, screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAuth, mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { SettingsReset } from './SettingsReset'; describe('renderer/components/settings/SettingsReset.tsx', () => { @@ -13,20 +13,11 @@ describe('renderer/components/settings/SettingsReset.tsx', () => { }); it('should reset default settings when `OK`', async () => { - window.confirm = jest.fn(() => true); // always click 'OK' + globalThis.confirm = jest.fn(() => true); // always click 'OK' await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, settings: mockSettings, resetSettings }); }); await userEvent.click(screen.getByTestId('settings-reset')); @@ -36,20 +27,11 @@ describe('renderer/components/settings/SettingsReset.tsx', () => { }); it('should skip reset default settings when `cancelled`', async () => { - window.confirm = jest.fn(() => false); // always click 'cancel' + globalThis.confirm = jest.fn(() => false); // always click 'cancel' await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, settings: mockSettings, resetSettings }); }); await userEvent.click(screen.getByTestId('settings-reset')); diff --git a/src/renderer/components/settings/SystemSettings.test.tsx b/src/renderer/components/settings/SystemSettings.test.tsx index 23f4dce74..b2cc4a14f 100644 --- a/src/renderer/components/settings/SystemSettings.test.tsx +++ b/src/renderer/components/settings/SystemSettings.test.tsx @@ -1,8 +1,8 @@ -import { act, render, screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAuth, mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import type { Percentage } from '../../types'; import { SystemSettings } from './SystemSettings'; @@ -15,17 +15,11 @@ describe('renderer/components/settings/SystemSettings.tsx', () => { it('should change the open links radio group', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, + settings: mockSettings, + updateSetting, + }); }); await userEvent.click(screen.getByTestId('radio-openLinks-background')); @@ -36,17 +30,11 @@ describe('renderer/components/settings/SystemSettings.tsx', () => { it('should toggle the keyboardShortcut checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, + settings: mockSettings, + updateSetting, + }); }); await userEvent.click(screen.getByTestId('checkbox-keyboardShortcut')); @@ -57,17 +45,11 @@ describe('renderer/components/settings/SystemSettings.tsx', () => { it('should toggle the showNotifications checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, + settings: mockSettings, + updateSetting, + }); }); await userEvent.click(screen.getByTestId('checkbox-showNotifications')); @@ -78,17 +60,11 @@ describe('renderer/components/settings/SystemSettings.tsx', () => { describe('playSound', () => { it('should toggle the playSound checkbox', async () => { - const { rerender } = render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, + settings: mockSettings, + updateSetting, + }); await userEvent.click(screen.getByTestId('checkbox-playSound')); @@ -96,33 +72,27 @@ describe('renderer/components/settings/SystemSettings.tsx', () => { expect(updateSetting).toHaveBeenCalledWith('playSound', false); // Simulate update to context with playSound = false - rerender( - - - , - ); + // rerender( + // + // + // , + // ); expect(screen.getByTestId('settings-volume-group')).not.toBeVisible(); }); it('should increase notification volume', async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, + settings: mockSettings, + updateSetting, + }); await userEvent.click(screen.getByTestId('settings-volume-up')); @@ -131,17 +101,11 @@ describe('renderer/components/settings/SystemSettings.tsx', () => { }); it('should decrease notification volume', async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, + settings: mockSettings, + updateSetting, + }); await userEvent.click(screen.getByTestId('settings-volume-down')); @@ -150,20 +114,11 @@ describe('renderer/components/settings/SystemSettings.tsx', () => { }); it('should reset notification volume', async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, + settings: { ...mockSettings, notificationVolume: 30 as Percentage }, + updateSetting, + }); await userEvent.click(screen.getByTestId('settings-volume-reset')); @@ -174,17 +129,11 @@ describe('renderer/components/settings/SystemSettings.tsx', () => { it('should toggle the openAtStartup checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + auth: mockAuth, + settings: mockSettings, + updateSetting, + }); }); await userEvent.click(screen.getByTestId('checkbox-openAtStartup')); diff --git a/src/renderer/components/settings/TraySettings.test.tsx b/src/renderer/components/settings/TraySettings.test.tsx index 98737b2cd..d3aa54d19 100644 --- a/src/renderer/components/settings/TraySettings.test.tsx +++ b/src/renderer/components/settings/TraySettings.test.tsx @@ -1,8 +1,8 @@ -import { act, render, screen } from '@testing-library/react'; +import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { renderWithAppContext } from '../../__helpers__/test-utils'; import { mockAuth, mockSettings } from '../../__mocks__/state-mocks'; -import { AppContext } from '../../context/App'; import { TraySettings } from './TraySettings'; describe('renderer/components/settings/TraySettings.tsx', () => { @@ -14,17 +14,11 @@ describe('renderer/components/settings/TraySettings.tsx', () => { it('should toggle the showNotificationsCountInTray checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click( @@ -40,17 +34,11 @@ describe('renderer/components/settings/TraySettings.tsx', () => { it('should toggle the useUnreadActiveIcon checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-useUnreadActiveIcon')); @@ -61,17 +49,11 @@ describe('renderer/components/settings/TraySettings.tsx', () => { it('should toggle the useAlternateIdleIcon checkbox', async () => { await act(async () => { - render( - - - , - ); + renderWithAppContext(, { + + auth: mockAuth, + settings: mockSettings, + updateSetting }); }); await userEvent.click(screen.getByTestId('checkbox-useAlternateIdleIcon')); diff --git a/src/renderer/components/settings/__snapshots__/SettingsFooter.test.tsx.snap b/src/renderer/components/settings/__snapshots__/SettingsFooter.test.tsx.snap index 3e4b49a6e..a02b0f6ca 100644 --- a/src/renderer/components/settings/__snapshots__/SettingsFooter.test.tsx.snap +++ b/src/renderer/components/settings/__snapshots__/SettingsFooter.test.tsx.snap @@ -2,7 +2,7 @@ exports[`renderer/components/settings/SettingsFooter.tsx should show app version 1`] = ` - -
-
- -

- Accounts -

-
-
-
- - -
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.com - -
-
- - - Personal Access Token - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.gitify.io - -
-
- - - OAuth App - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.com - -
-
- - - GitHub App - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
- - -`; - -exports[`renderer/routes/Accounts.tsx Account interactions should set account as primary account 1`] = ` -
-
-
- - -
-
- -

- Accounts -

-
-
-
-
-
-
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.com - -
-
- - - Personal Access Token - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.gitify.io - -
-
- - - OAuth App - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.com - -
-
- - - GitHub App - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
- -
-`; - -exports[`renderer/routes/Accounts.tsx General should render itself & its children 1`] = ` -
-
-
- - -
-
- -

- Accounts -

-
-
-
-
-
-
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.com - -
-
- - - Personal Access Token - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.gitify.io - -
-
- - - OAuth App - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
-
-
- -
-
-
-
-
- - - Mona Lisa Octocat - -
-
- - - github.com - -
-
- - - GitHub App - -
-
-
-
- - - - -
- -
- - - -
-
-
-
-
- -
-`; diff --git a/src/renderer/routes/__snapshots__/Filters.test.tsx.snap b/src/renderer/routes/__snapshots__/Filters.test.tsx.snap index 3887338dc..b618312f0 100644 --- a/src/renderer/routes/__snapshots__/Filters.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/Filters.test.tsx.snap @@ -17,7 +17,7 @@ exports[`renderer/routes/Filters.tsx General should render itself & its children data-wrap="nowrap" > - - + + + + + + GitHub + + + + + + + @@ -235,228 +246,239 @@ exports[`renderer/routes/Login.tsx should render itself & its children 1`] = ` , "container":
- -
-

- GitHub Notifications -

-

- on your menu bar -

-
- - Login with - - - -
+
- + Login with - - OAuth App - - - + + + + + + GitHub + + + + + +
+
diff --git a/src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap b/src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap index 9707a5e76..b68ec672e 100644 --- a/src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap @@ -6,66 +6,44 @@ exports[`renderer/routes/LoginWithOAuthApp.tsx renders correctly 1`] = ` "baseElement":
- -
-
-

+ +
- Login with OAuth App -

-
+
+ +

+ Login with OAuth App +

+
+
+
- -
-
-
-
+
- - - - - +
+ + + and use your + + client id & secret + + below. + +
+
+ + + + +
+
+ + + + + + + + +
+
+
+ +
+ + + + , + "container":
+
+
+
+
+ +
+
- +

+ Login with OAuth App +

+
+
+
+
+
+
+
+
+ + + - - - and use your - - client id & secret - - below. - -
-
-
+
- - - Client ID - - - * + + + + + + Create new OAuth App + + + + and use your + + client id & secret + + below. - - - - -
-
-
-
- -
-
- , - "container":
-
-
-
- - -
-
- -

- Login with OAuth App -

-
-
-
-
-
-
-
-
- - - - - - - Change only if you are using GitHub Enterprise Server - - -
-
- - - and use your - - client id & secret - - below. - -
-
- - - - -
-
- - - - - - - -
-
-
-
diff --git a/src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap b/src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap index 90139820e..aee7a7dd4 100644 --- a/src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap @@ -6,66 +6,44 @@ exports[`renderer/routes/LoginWithPersonalAccessToken.tsx renders correctly 1`] "baseElement":
- -
-
-

+ +
- Login with Personal Access Token -

-
+
+ +

+ Login with Personal Access Token +

+
+
+
- -
-
-
-
+
- - - - - - +
- Change only if you are using GitHub Enterprise Server - - +
+ + + on GitHub to paste the token below. + +
+ + The + + + + + will be automatically selected for you. + +
+
+ + + + + + + + +
+
- - on GitHub to paste the token below. - -
- - The - - - - will be automatically selected for you. - -
-
- - - - - - - +
+
+ + + , + "container":
+
+
-
-
- , - "container":
-
-
-
- -
+
+ + + + + + + Change only if you are using GitHub Enterprise Server + + +
- -

+ + + + + + Generate a PAT + + + + + on GitHub to paste the token below. + +

+ - Login with Personal Access Token - + The + + + + + will be automatically selected for you. +
-
- -
-
-
-
-
- - - - - - - Change only if you are using GitHub Enterprise Server - - +
+
- - on GitHub to paste the token below. - -
- - The - - - - will be automatically selected for you. - -
-
- - - - - - - -
-
-
- diff --git a/src/renderer/routes/__snapshots__/Notifications.test.tsx.snap b/src/renderer/routes/__snapshots__/Notifications.test.tsx.snap index e2500c2b2..c5fbe4781 100644 --- a/src/renderer/routes/__snapshots__/Notifications.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/Notifications.test.tsx.snap @@ -5,15 +5,37 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children ( "asFragment": [Function], "baseElement":
-

- AllRead -

+
+
+

+ AllRead +

+
+
, "container":
-

- AllRead -

+
+
+

+ AllRead +

+
+
, "debug": [Function], "findAllByAltText": [Function], @@ -74,15 +96,37 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children ( "asFragment": [Function], "baseElement":
-

- Oops -

+
+
+

+ Oops +

+
+
, "container":
-

- Oops -

+
+
+

+ Oops +

+
+
, "debug": [Function], "findAllByAltText": [Function], @@ -143,15 +187,37 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children ( "asFragment": [Function], "baseElement":
-

- Oops -

+
+
+

+ Oops +

+
+
, "container":
-

- Oops -

+
+
+

+ Oops +

+
+
, "debug": [Function], "findAllByAltText": [Function], @@ -212,15 +278,37 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children ( "asFragment": [Function], "baseElement":
-

- Oops -

+
+
+

+ Oops +

+
+
, "container":
-

- Oops -

+
+
+

+ Oops +

+
+
, "debug": [Function], "findAllByAltText": [Function], @@ -281,15 +369,37 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children ( "asFragment": [Function], "baseElement":
-

- Oops -

+
+
+

+ Oops +

+
+
, "container":
-

- Oops -

+
+
+

+ Oops +

+
+
, "debug": [Function], "findAllByAltText": [Function], @@ -350,15 +460,37 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children ( "asFragment": [Function], "baseElement":
-

- Oops -

+
+
+

+ Oops +

+
+
, "container":
-

- Oops -

+
+
+

+ Oops +

+
+
, "debug": [Function], "findAllByAltText": [Function], @@ -419,15 +551,37 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children ( "asFragment": [Function], "baseElement":
-

- AllRead -

+
+
+

+ AllRead +

+
+
, "container":
-

- AllRead -

+
+
+

+ AllRead +

+
+
, "debug": [Function], "findAllByAltText": [Function], @@ -488,15 +642,37 @@ exports[`renderer/routes/Notifications.tsx should render itself & its children ( "asFragment": [Function], "baseElement":
-

- AllRead -

+
+
+

+ AllRead +

+
+
, "container":
-

- AllRead -

+
+
+

+ AllRead +

+
+
, "debug": [Function], "findAllByAltText": [Function], diff --git a/src/renderer/routes/__snapshots__/Settings.test.tsx.snap b/src/renderer/routes/__snapshots__/Settings.test.tsx.snap index fc1029368..8654c70bf 100644 --- a/src/renderer/routes/__snapshots__/Settings.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/Settings.test.tsx.snap @@ -17,7 +17,7 @@ exports[`renderer/routes/Settings.tsx should render itself & its children 1`] = data-wrap="nowrap" > + + + + + + + + + @@ -323,10 +405,10 @@ exports[`renderer/components/Sidebar.tsx should render itself & its children (lo aria-hidden="true" class="prc-TooltipV2-Tooltip-cYMVY" data-direction="e" - id="_r_9_" + id="_r_d_" popover="auto" > - Quit Gitify + Settings @@ -468,8 +550,47 @@ exports[`renderer/components/Sidebar.tsx should render itself & its children (lo undefined unread notifications ↗ + + + + @@ -589,10 +753,10 @@ exports[`renderer/components/Sidebar.tsx should render itself & its children (lo aria-hidden="true" class="prc-TooltipV2-Tooltip-cYMVY" data-direction="e" - id="_r_9_" + id="_r_d_" popover="auto" > - Quit Gitify + Settings @@ -685,7 +849,7 @@ exports[`renderer/components/Sidebar.tsx should render itself & its children (lo data-wrap="nowrap" >