@@ -107,10 +107,10 @@ describe('Tests for NotificationsStore', function () {
107107
108108 jest . runAllTimers ( ) ;
109109
110- var repository = NotificationsStore . _notifications [ 0 ] [ 0 ] . repository ;
111- var subject = NotificationsStore . _notifications [ 0 ] [ 0 ] . subject ;
110+ var repository = NotificationsStore . _notifications [ 0 ] . repository ;
111+ var subjectTitle = NotificationsStore . _notifications [ 0 ] . subject . title ;
112112 expect ( repository . full_name ) . toBe ( 'octocat/Hello-World' ) ;
113- expect ( subject . title ) . toBe ( 'Greetings' ) ;
113+ expect ( subjectTitle ) . toBe ( 'Greetings' ) ;
114114 expect ( NotificationsStore . trigger ) . toHaveBeenCalled ( ) ;
115115
116116 } ) ;
@@ -133,7 +133,7 @@ describe('Tests for NotificationsStore', function () {
133133
134134 } ) ;
135135
136- it ( 'should FAIL to create a booking via the API' , function ( ) {
136+ it ( 'should FAIL to get the notifications from the GitHub API' , function ( ) {
137137
138138 spyOn ( NotificationsStore , 'trigger' ) ;
139139 spyOn ( NotificationsStore , 'onGetNotificationsFailed' ) ;
@@ -149,4 +149,53 @@ describe('Tests for NotificationsStore', function () {
149149
150150 } ) ;
151151
152+ it ( 'should mark a notification as read - remove single notification from store' , function ( ) {
153+
154+ spyOn ( NotificationsStore , 'trigger' ) ;
155+
156+ NotificationsStore . _notifications = [ 'abc' , 'def' ] ;
157+
158+ expect ( NotificationsStore . _notifications . length ) . toBe ( 2 ) ;
159+
160+ Actions . removeNotification ( 'abc' ) ;
161+
162+ jest . runAllTimers ( ) ;
163+
164+ expect ( NotificationsStore . _notifications . length ) . toBe ( 1 ) ;
165+ expect ( NotificationsStore . trigger ) . toHaveBeenCalled ( ) ;
166+
167+ } ) ;
168+
169+ it ( 'should mark a repo as read - remove notifications from store' , function ( ) {
170+
171+ spyOn ( NotificationsStore , 'trigger' ) ;
172+
173+ NotificationsStore . _notifications = [
174+ {
175+ 'id' : '1' ,
176+ 'repository' : {
177+ 'full_name' : 'ekonstantinidis/gitify'
178+ } ,
179+ 'unread' : true
180+ } ,
181+ {
182+ 'id' : '2' ,
183+ 'repository' : {
184+ 'full_name' : 'ekonstantinidis/gitify'
185+ } ,
186+ 'reason' : 'subscribed'
187+ }
188+ ] ;
189+
190+ expect ( NotificationsStore . _notifications . length ) . toBe ( 2 ) ;
191+
192+ Actions . removeRepoNotifications ( 'ekonstantinidis/gitify' ) ;
193+
194+ jest . runAllTimers ( ) ;
195+
196+ expect ( NotificationsStore . _notifications . length ) . toBe ( 0 ) ;
197+ expect ( NotificationsStore . trigger ) . toHaveBeenCalled ( ) ;
198+
199+ } ) ;
200+
152201} ) ;
0 commit comments