• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gitify-app / gitify / 12299146741

12 Dec 2024 03:06PM UTC coverage: 87.358% (+0.02%) from 87.342%
12299146741

Pull #1672

github

web-flow
Merge e79b7a7bb into e9c5293b2
Pull Request #1672: refactor: extract feature based utils

592 of 655 branches covered (90.38%)

Branch coverage included in aggregate %.

20 of 21 new or added lines in 5 files covered. (95.24%)

1557 of 1805 relevant lines covered (86.26%)

24.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.96
/src/renderer/utils/notifications/remove.ts
1
import type { AccountNotifications, SettingsState } from '../../types';
2
import type { Notification } from '../../typesGitHub';
3
import { getAccountUUID } from '../auth/utils';
70✔
4

5
export function removeNotifications(
70✔
6
  settings: SettingsState,
7
  notificationsToRemove: Notification[],
8
  allNotifications: AccountNotifications[],
9
): AccountNotifications[] {
10
  if (settings.delayNotificationState) {
8✔
11
    return allNotifications;
2✔
12
  }
13

14
  if (notificationsToRemove.length === 0) {
6!
15
    return allNotifications;
×
16
  }
17

18
  const removeNotificationAccount = notificationsToRemove[0].account;
6✔
19
  const removeNotificationIDs = notificationsToRemove.map(
6✔
20
    (notification) => notification.id,
6✔
21
  );
22

23
  const accountIndex = allNotifications.findIndex(
6✔
24
    (accountNotifications) =>
25
      getAccountUUID(accountNotifications.account) ===
2✔
26
      getAccountUUID(removeNotificationAccount),
27
  );
28

29
  if (accountIndex !== -1) {
6✔
30
    const updatedNotifications = [...allNotifications];
2✔
31
    updatedNotifications[accountIndex] = {
2✔
32
      ...updatedNotifications[accountIndex],
33
      notifications: updatedNotifications[accountIndex].notifications.filter(
34
        (notification) => !removeNotificationIDs.includes(notification.id),
2✔
35
      ),
36
    };
37
    return updatedNotifications;
2✔
38
  }
39

40
  return allNotifications;
4✔
41
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc