@@ -6,6 +6,7 @@ jest.dontMock('../../utils/api-requests');
66jest . dontMock ( '../../components/notification.js' ) ;
77jest . dontMock ( '../../stores/auth.js' ) ;
88jest . dontMock ( '../../stores/notifications.js' ) ;
9+ jest . dontMock ( '../../stores/settings.js' ) ;
910
1011var React = require ( 'react/addons' ) ;
1112var TestUtils = React . addons . TestUtils ;
@@ -48,6 +49,7 @@ describe('Test for Notification Component', function () {
4849 AuthStore = require ( '../../stores/auth.js' ) ;
4950 SingleNotification = require ( '../../components/notification.js' ) ;
5051 NotificationsStore = require ( '../../stores/notifications.js' ) ;
52+ SettingsStore = require ( '../../stores/settings.js' ) ;
5153 } ) ;
5254
5355 it ( 'Should render a notification component (Issue)' , function ( ) {
@@ -72,12 +74,28 @@ describe('Test for Notification Component', function () {
7274 key = { notification . id } /> ) ;
7375
7476 expect ( instance . state . isRead ) . toBeFalsy ( ) ;
77+ expect ( instance . pressTitle ) . toBeDefined ( ) ;
7578 expect ( instance . openBrowser ) . toBeDefined ( ) ;
7679 expect ( instance . markAsRead ) . toBeDefined ( ) ;
7780
81+ spyOn ( instance , 'openBrowser' ) ;
82+ spyOn ( instance , 'markAsRead' ) ;
83+
84+ instance . pressTitle ( ) ;
85+ expect ( instance . openBrowser ) . toHaveBeenCalled ( ) ;
86+
7887 // Open Browser
7988 instance . openBrowser ( ) ;
8089
90+ // If 'markOnClick' is ON
91+ SettingsStore . onSetSetting ( 'markOnClick' , true ) ;
92+
93+ instance . pressTitle ( ) ;
94+
95+ expect ( instance . openBrowser ) . toHaveBeenCalled ( ) ;
96+ expect ( instance . markAsRead ) . toHaveBeenCalled ( ) ;
97+ jest . runAllTimers ( ) ;
98+
8199 } ) ;
82100
83101 it ( 'Should render a notification component (PullRequest)' , function ( ) {
@@ -105,6 +123,9 @@ describe('Test for Notification Component', function () {
105123 expect ( instance . openBrowser ) . toBeDefined ( ) ;
106124 expect ( instance . markAsRead ) . toBeDefined ( ) ;
107125
126+ // Open Browser
127+ instance . openBrowser ( ) ;
128+
108129 } ) ;
109130
110131 it ( 'Should render a notification component (OtherType)' , function ( ) {
0 commit comments