Skip to content

Commit 18f6413

Browse files
committed
fix: provide complete AppContextState defaults in test utils
1 parent 736bf2c commit 18f6413

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

src/renderer/__helpers__/test-utils.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,41 @@ export function AppContextProvider({
2222
children,
2323
value = {},
2424
}: AppContextProviderProps) {
25-
const defaultValue: Partial<AppContextState> = useMemo(() => {
25+
const defaultValue: AppContextState = useMemo(() => {
2626
return {
2727
auth: mockAuth,
2828
settings: mockSettings,
2929
isLoggedIn: true,
3030

3131
notifications: [],
32+
notificationCount: 0,
33+
unreadNotificationCount: 0,
34+
hasNotifications: false,
35+
hasUnreadNotifications: false,
3236

3337
status: 'success',
3438
globalError: null,
3539

40+
// Default mock implementations for all required methods
41+
loginWithGitHubApp: jest.fn(),
42+
loginWithOAuthApp: jest.fn(),
43+
loginWithPersonalAccessToken: jest.fn(),
44+
logoutFromAccount: jest.fn(),
45+
46+
fetchNotifications: jest.fn(),
47+
removeAccountNotifications: jest.fn(),
48+
49+
markNotificationsAsRead: jest.fn(),
50+
markNotificationsAsDone: jest.fn(),
51+
unsubscribeNotification: jest.fn(),
52+
53+
clearFilters: jest.fn(),
54+
resetSettings: jest.fn(),
55+
updateSetting: jest.fn(),
56+
updateFilter: jest.fn(),
57+
3658
...value,
37-
} as Partial<AppContextState>;
59+
} as AppContextState;
3860
}, [value]);
3961

4062
return (

src/renderer/components/__snapshots__/Sidebar.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/layout/__snapshots__/AppLayout.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)