Created
February 15, 2018 21:50
-
-
Save agnanachandran/08d887843230c08536ab223ba9104f24 to your computer and use it in GitHub Desktop.
tests/notifications_store_test.ts
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
describe('Notifications Store', () => { | |
it('should have read and unread notifications', () => { | |
const readNotification = new Notification('1', 'read', 100, true); | |
const unreadNotification = new Notification('2', 'unread', 101, false); | |
const unreadNotification2 = new Notification('3', 'unread2', 102, false); | |
const notifications = [readNotification, unreadNotification, unreadNotification2]; | |
const notificationsStore = NotificationsStore.initialize(notifications); | |
expect(notificationsStore.unreadNotifications).to.have.length(2); | |
// Ensure unread notifications are in reverse chronological order by creation time | |
expect(notificationsStore.unreadNotifications[0].time).to.equal(102); | |
expect(notificationsStore.unreadNotifications[1].time).to.equal(101); | |
expect(notificationsStore.readNotifications).to.have.length(1); | |
expect(notificationsStore.readNotifications[0].id).to.equal('1'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment