Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Optional: If you prefer to use your own OAuth credentials, you can do so by pass

To watch for changes(`webpack`) in the `src` directory:

pnpm run watch
pnpm watch

To run the **electron app**:

Expand All @@ -54,15 +54,17 @@ The release process is automated. Follow the steps below.
### Tests

There are 2 checks - one for prettier and one for the unit tests with `jest`.

```
// Run prettier to check
pnpm run prettier:check
pnpm prettier:check

// Run linter & unit tests with coverage
pnpm run test
pnpm test

// Run jest directly - allows to pass arguments like `--watch`
pnpm run jest
// If you want to pass arguments to jest (or other `pnpm` commands)
// like `--watch`, you can prepend `--` to the command
pnpm test -- --watch
```

### FAQ

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"jest": "^26.6.3",
"nock": "^13.0.5",
"postcss-loader": "^4.1.0",
"prettier": "=2.2.1",
"prettier": "^2.8.8",
"react-test-renderer": "=16.13.1",
"style-loader": "^2.0.0",
"ts-jest": "^26.4.4",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions src/routes/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ import { Oops } from '../components/Oops';
export const NotificationsRoute: React.FC = (props) => {
const { notifications, requestFailed } = useContext(AppContext);

const hasMultipleAccounts = useMemo(() => notifications.length > 1, [
notifications,
]);
const hasMultipleAccounts = useMemo(
() => notifications.length > 1,
[notifications]
);
const notificationsCount = useMemo(
() =>
notifications.reduce((memo, acc) => memo + acc.notifications.length, 0),
[notifications]
);
const hasNotifications = useMemo(() => notificationsCount > 0, [
notificationsCount,
]);
const hasNotifications = useMemo(
() => notificationsCount > 0,
[notificationsCount]
);

if (requestFailed) {
return <Oops />;
Expand Down
7 changes: 4 additions & 3 deletions src/utils/github-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const DESCRIPTIONS = {
UNKNOWN: 'The reason for this notification is not supported by the app.',
};

export function formatReason(
reason: Reason
): { type: string; description: string } {
export function formatReason(reason: Reason): {
type: string;
description: string;
} {
// prettier-ignore
switch (reason) {
case 'assign':
Expand Down
9 changes: 5 additions & 4 deletions src/utils/notifications.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ describe('utils/notifications.ts', () => {
it('should click on a native notification (with 1 notification)', () => {
spyOn(comms, 'openExternalLink');

const nativeNotification: Notification = notificationsHelpers.raiseNativeNotification(
[mockedGithubNotifications[0]],
mockedUser.id
);
const nativeNotification: Notification =
notificationsHelpers.raiseNativeNotification(
[mockedGithubNotifications[0]],
mockedUser.id
);
nativeNotification.onclick(null);

const notif = mockedGithubNotifications[0];
Expand Down
5 changes: 2 additions & 3 deletions src/utils/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ export const triggerNativeNotifications = (
return account.notifications;
}

const accountPreviousNotificationsIds = accountPreviousNotifications.notifications.map(
(item) => item.id
);
const accountPreviousNotificationsIds =
accountPreviousNotifications.notifications.map((item) => item.id);

const accountNewNotifications = account.notifications.filter((item) => {
return !accountPreviousNotificationsIds.includes(`${item.id}`);
Expand Down