Skip to content

Commit c8641c9

Browse files
committed
fix: notification read state for delayNotificationState
Signed-off-by: Adam Setch <[email protected]>
1 parent 587eb50 commit c8641c9

File tree

4 files changed

+1197
-25
lines changed

4 files changed

+1197
-25
lines changed

src/renderer/components/notifications/NotificationRow.test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,28 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => {
8484
expect(tree).toMatchSnapshot();
8585
});
8686

87+
it('should render itself & its children - notification is read', async () => {
88+
jest
89+
.spyOn(global.Date, 'now')
90+
.mockImplementation(() => new Date('2024').valueOf());
91+
92+
const props = {
93+
notification: {
94+
...mockSingleNotification,
95+
unread: false,
96+
},
97+
account: mockGitHubCloudAccount,
98+
};
99+
100+
const tree = render(
101+
<AppContext.Provider value={{ settings: mockSettings }}>
102+
<NotificationRow {...props} />
103+
</AppContext.Provider>,
104+
);
105+
106+
expect(tree).toMatchSnapshot();
107+
});
108+
87109
describe('notification interactions', () => {
88110
it('should open a notification in the browser - click', async () => {
89111
const markNotificationsAsRead = jest.fn();

src/renderer/components/notifications/RepositoryNotifications.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ describe('renderer/components/notifications/RepositoryNotifications.tsx', () =>
3939
expect(tree).toMatchSnapshot();
4040
});
4141

42+
it('should render itself & its children - all notifications are read', () => {
43+
for (const n of props.repoNotifications) {
44+
n.unread = false;
45+
}
46+
47+
const tree = render(
48+
<AppContext.Provider value={{}}>
49+
<RepositoryNotifications {...props} />
50+
</AppContext.Provider>,
51+
);
52+
53+
expect(tree).toMatchSnapshot();
54+
});
55+
4256
it('should open the browser when clicking on the repo name', async () => {
4357
const openExternalLinkMock = jest
4458
.spyOn(comms, 'openExternalLink')

0 commit comments

Comments
 (0)