Skip to content

Commit b452413

Browse files
committed
One More Test
1 parent 615ab2e commit b452413

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/js/__mocks__/mockedData.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export const mockedEnterpriseAccounts = fromJS([
77
},
88
]);
99

10+
// 2 Notifications
11+
// Repository : 'manosim/notifications-tests'
1012
export const mockedGithubNotifications = fromJS([
1113
{
1214
'id': '138661096',
@@ -98,6 +100,9 @@ export const mockedGithubNotifications = fromJS([
98100
}
99101
]);
100102

103+
104+
// 2 Notifications
105+
// Repository : 'myorg/notifications-test'
101106
export const mockedEnterpriseNotifications = fromJS([
102107
{
103108
'id': '4',

src/js/__tests__/middleware/notifications.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ import { mockedGithubNotifications, mockedNotificationsRecuderData } from '../..
66
import notificationsMiddleware from '../../middleware/notifications';
77
import NativeNotifications from '../../utils/notifications';
88

9+
// Keep 3 notifications
10+
// Ps. To receive 4 on actions.NOTIFICATIONS.SUCCESS,
911
const mockedNotifications = mockedNotificationsRecuderData
1012
.deleteIn([0, 'notifications', 0]);
1113

1214
const createFakeStore = (fakeData) => ({
1315
getState() {
1416
return {
1517
notifications: Map({
16-
response: mockedNotifications
18+
response: mockedNotifications,
1719
}),
1820
settings: Map({
1921
playSound: false,
@@ -76,12 +78,15 @@ describe('middleware/notifications.js', () => {
7678
const action = {
7779
type: actions.MARK_REPO_NOTIFICATION.SUCCESS,
7880
meta: {
79-
repoSlug: 'manosim/gitify'
81+
repoSlug: 'manosim/notifications-test',
82+
hostname: 'github.com',
8083
}
8184
};
8285

8386
expect(dispatchWithStoreOf({}, action)).toEqual(action);
8487
expect(comms.updateTrayIcon).toHaveBeenCalledTimes(1);
85-
expect(comms.updateTrayIcon).toHaveBeenCalledWith(3);
88+
expect(comms.updateTrayIcon).toHaveBeenCalledWith(2);
89+
expect(comms.setBadge).toHaveBeenCalledTimes(1);
90+
expect(comms.setBadge).toHaveBeenCalledWith(2);
8691
});
8792
});

0 commit comments

Comments
 (0)