-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: add notificationService tests * Test: add Notification router tests * Test: add integration test for notifications * Fix: notification tests to work with new behaviour * Chore: swap constants to SCREAMING_SNAKE_CASE * Chore: fix test description * Chore: add comments * Chore: modify test names * Fix: cleanup tables between tests
- Loading branch information
1 parent
7b74cee
commit ac2a5c9
Showing
6 changed files
with
823 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const CREATED_TIME = new Date() | ||
const READ_TIME = new Date() | ||
const OLD_READ_TIME = new Date("1995-12-17T03:24:00") | ||
|
||
export const normalPriorityUnreadNotification = { | ||
message: "low priority unread notification", | ||
link: "google.com", | ||
sourceUsername: "user", | ||
type: "sent_request", | ||
firstReadTime: null, | ||
priority: 2, | ||
createdAt: CREATED_TIME, | ||
} | ||
|
||
export const normalPriorityReadNotification = { | ||
...normalPriorityUnreadNotification, | ||
message: "low priority read notification", | ||
firstReadTime: READ_TIME, | ||
} | ||
|
||
export const highPriorityUnreadNotification = { | ||
...normalPriorityUnreadNotification, | ||
message: "high priority unread notification", | ||
priority: 1, | ||
} | ||
|
||
export const highPriorityReadNotification = { | ||
...normalPriorityReadNotification, | ||
message: "high priority read notification", | ||
priority: 1, | ||
} | ||
|
||
export const normalPriorityOldReadNotification = { | ||
...normalPriorityReadNotification, | ||
message: "low priority old notification", | ||
firstReadTime: OLD_READ_TIME, | ||
} | ||
|
||
export const highPriorityOldReadNotification = { | ||
...highPriorityReadNotification, | ||
message: "high priority old notification", | ||
firstReadTime: OLD_READ_TIME, | ||
} | ||
|
||
export const formatNotification = (notification: any) => ({ | ||
message: notification.message, | ||
createdAt: CREATED_TIME.toISOString(), | ||
link: notification.link, | ||
isRead: !!notification.firstReadTime, | ||
sourceUsername: notification.sourceUsername, | ||
type: notification.type, | ||
}) |
Oops, something went wrong.