Created
February 15, 2018 21:50
-
-
Save agnanachandran/08d887843230c08536ab223ba9104f24 to your computer and use it in GitHub Desktop.
Revisions
-
agnanachandran created this gist
Feb 15, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ 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'); }); });