File tree Expand file tree Collapse file tree 1 file changed +40
-1
lines changed
src/js/__tests__/components Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ describe('Test for Repository Component', function () {
7878
7979 } ) ;
8080
81- it ( 'Should mark a repo as read - succsfully ' , function ( ) {
81+ it ( 'Should mark a repo as read - successfully ' , function ( ) {
8282
8383 var repoDetails = [ {
8484 'repository' : {
@@ -115,4 +115,43 @@ describe('Test for Repository Component', function () {
115115
116116 } ) ;
117117
118+ it ( 'Should mark a repo as read - fail' , function ( ) {
119+
120+ var repoDetails = [ {
121+ 'repository' : {
122+ 'name' : 'gitify' ,
123+ 'full_name' : 'ekonstantinidis/gitify' ,
124+ 'owner' : {
125+ 'login' : 'ekonstantinidis' ,
126+ 'avatar_url' : 'http://avatar.url'
127+ }
128+ } ,
129+ 'subject' : {
130+ 'type' : 'Issue'
131+ }
132+ } ] ;
133+
134+ var instance = TestUtils . renderIntoDocument (
135+ < Repository
136+ repo = { repoDetails }
137+ repoName = 'ekonstantinidis/gitify'
138+ key = 'ekonstantinidis/gitify' />
139+ ) ;
140+
141+ expect ( instance . state . isRead ) . toBeFalsy ( ) ;
142+ expect ( instance . state . errors ) . toBeFalsy ( ) ;
143+ expect ( instance . markRepoAsRead ) . toBeDefined ( ) ;
144+
145+ var superagent = require ( 'superagent' ) ;
146+ superagent . __setResponse ( 400 , false ) ;
147+
148+ // Mark Repo as Read
149+ instance . markRepoAsRead ( ) ;
150+ jest . runAllTimers ( ) ;
151+
152+ expect ( instance . state . isRead ) . toBeFalsy ( ) ;
153+ expect ( instance . state . errors ) . toBeTruthy ( ) ;
154+
155+ } ) ;
156+
118157} ) ;
You can’t perform that action at this time.
0 commit comments