Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/notifications tests #514

Merged
merged 9 commits into from
Jan 5, 2023
52 changes: 52 additions & 0 deletions src/fixtures/notifications.ts
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,
})
Loading