Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
eba06a3
feat: add 'Show read notifications' setting (#708)
afonsojramos Dec 30, 2025
1b0b1d6
fix: hide mark as read button on read notifications
afonsojramos Dec 30, 2025
7db4167
fix: fetch read notifications from API when setting enabled
afonsojramos Dec 30, 2025
a8271e7
test: update Settings snapshot for showReadNotifications default
afonsojramos Dec 31, 2025
cc5e1ca
refactor: address PR feedback for showReadNotifications
afonsojramos Jan 1, 2026
4c8936d
refactor: move mark as done button to far right
afonsojramos Jan 1, 2026
54f4d4a
refactor: address PR review feedback from setchy
afonsojramos Jan 1, 2026
7ae3d1b
style: fix formatting in NotificationSettings test
afonsojramos Jan 1, 2026
461df1d
refactor: reorder hover group buttons to keep chevron as right-most item
setchy Jan 1, 2026
acd18b7
refactor: handle mark as done limitation when fetching read notificat…
afonsojramos Jan 9, 2026
94ddbb0
fix: provide complete AppContextState defaults in test utils
afonsojramos Jan 10, 2026
2fd7bcc
fix: correct mock variable references in tests after rebase
afonsojramos Jan 11, 2026
0367557
test: update Settings snapshot for tooltip testid change
afonsojramos Jan 11, 2026
d8fee7a
test: update login route snapshots for primer ID changes
afonsojramos Jan 11, 2026
af79d65
test: add coverage for fetchReadNotifications fallback behavior
afonsojramos Jan 11, 2026
b363207
fix: keep notifications in list when fetchReadNotifications is enabled
afonsojramos Jan 11, 2026
35908f1
test: achieve 100% coverage for useNotifications hook
afonsojramos Jan 12, 2026
891c5ae
fix: stabilize snapshot tests by normalizing React auto-generated IDs
afonsojramos Jan 12, 2026
6987d84
ci: trigger workflow
afonsojramos Jan 12, 2026
57a3d50
test: update snapshots after rebase on main
afonsojramos Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/renderer/__helpers__/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ import '@testing-library/jest-dom';
*/
import '@primer/react/test-helpers';

/**
* Custom snapshot serializer to normalize React auto-generated IDs.
* This makes snapshots stable regardless of test execution order.
* React's useId() generates IDs like "_r_X_" where X changes based on
* how many components have rendered before.
*/
expect.addSnapshotSerializer({
test: (val) => typeof val === 'string' && /_r_[a-z0-9]+_/.test(val),
serialize: (val: string) => {
return `"${val.replace(/_r_[a-z0-9]+_/g, '_r_ID_')}"`;
},
});

/**
* Gitify context bridge API
*/
Expand Down
26 changes: 24 additions & 2 deletions src/renderer/__helpers__/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,41 @@ export function AppContextProvider({
children,
value = {},
}: AppContextProviderProps) {
const defaultValue: Partial<AppContextState> = useMemo(() => {
const defaultValue: AppContextState = useMemo(() => {
return {
auth: mockAuth,
settings: mockSettings,
isLoggedIn: true,

notifications: [],
notificationCount: 0,
unreadNotificationCount: 0,
hasNotifications: false,
hasUnreadNotifications: false,

status: 'success',
globalError: null,

// Default mock implementations for all required methods
loginWithGitHubApp: jest.fn(),
loginWithOAuthApp: jest.fn(),
loginWithPersonalAccessToken: jest.fn(),
logoutFromAccount: jest.fn(),

fetchNotifications: jest.fn(),
removeAccountNotifications: jest.fn(),

markNotificationsAsRead: jest.fn(),
markNotificationsAsDone: jest.fn(),
unsubscribeNotification: jest.fn(),

clearFilters: jest.fn(),
resetSettings: jest.fn(),
updateSetting: jest.fn(),
updateFilter: jest.fn(),

...value,
} as Partial<AppContextState>;
} as AppContextState;
}, [value]);

return (
Expand Down
1 change: 1 addition & 0 deletions src/renderer/__mocks__/state-mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const mockNotificationSettings: NotificationSettingsState = {
showPills: true,
showNumber: true,
participating: false,
fetchReadNotifications: false,
markAsDoneOnOpen: false,
markAsDoneOnUnsubscribe: false,
delayNotificationState: false,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Sidebar: FC = () => {
status,
settings,
auth,
unreadNotificationCount,
notificationCount,
hasUnreadNotifications,
updateSetting,
} = useAppContext();
Expand Down Expand Up @@ -92,7 +92,7 @@ export const Sidebar: FC = () => {
<IconButton
aria-label="Notifications"
data-testid="sidebar-notifications"
description={`${unreadNotificationCount} unread notifications ↗`}
description={`${notificationCount} ${settings.fetchReadNotifications ? 'notifications' : 'unread notifications'} ↗`}
icon={BellIcon}
onClick={() => openGitHubNotifications(primaryAccountHostname)}
size="small"
Expand Down
Loading