@@ -21,12 +21,20 @@ describe('Replies Module', () => {
2121 const setChatNotificationEnabled = sinon . spy ( NativeModules . IBGReplies , 'setInAppNotificationEnabled' ) ;
2222 const setEnableInAppNotificationSound = sinon . spy ( NativeModules . IBGReplies , 'setInAppNotificationSound' ) ;
2323 const setPushNotificationsEnabled = sinon . spy ( NativeModules . IBGReplies , 'setPushNotificationsEnabled' ) ;
24+ const setPushNotificationRegistrationToken = sinon . spy ( NativeModules . IBGReplies , 'setPushNotificationRegistrationToken' ) ;
25+ const setNotificationIcon = sinon . spy ( NativeModules . IBGReplies , 'setNotificationIcon' ) ;
26+ const setPushNotificationChannelId = sinon . spy ( NativeModules . IBGReplies , 'setPushNotificationChannelId' ) ;
27+ const setSystemReplyNotificationSoundEnabled = sinon . spy ( NativeModules . IBGReplies , 'setSystemReplyNotificationSoundEnabled' ) ;
2428
2529 beforeEach ( ( ) => {
2630 setOnNewReplyReceivedCallback . resetHistory ( ) ;
2731 setEnableInAppNotificationSound . resetHistory ( ) ;
2832 IBGEventEmitter . removeAllListeners ( ) ;
2933 setPushNotificationsEnabled . resetHistory ( ) ;
34+ setPushNotificationRegistrationToken . resetHistory ( ) ;
35+ setNotificationIcon . resetHistory ( ) ;
36+ setPushNotificationChannelId . resetHistory ( ) ;
37+ setSystemReplyNotificationSoundEnabled . resetHistory ( ) ;
3038 } ) ;
3139
3240 it ( 'should call the native method setRepliesEnabled' , ( ) => {
@@ -115,24 +123,73 @@ describe('Replies Module', () => {
115123
116124 } ) ;
117125
126+
118127 it ( 'should call the native method setPushNotificationsEnabled' , ( ) => {
119128
120- Platform . OS = 'ios' ;
121129 Replies . setPushNotificationsEnabled ( true ) ;
122130
123131 expect ( setPushNotificationsEnabled . calledOnceWithExactly ( true ) ) . toBe ( true ) ;
124132
125133 } ) ;
126134
127135
128- it ( 'should not call the native method setPushNotificationsEnabled when platform is android' , ( ) => {
136+ it ( 'should call the native method setPushNotificationRegistrationToken on Android' , ( ) => {
137+ Platform . OS = 'android' ;
138+ Replies . setPushNotificationRegistrationTokenAndroid ( '123' ) ;
139+
140+ expect ( setPushNotificationRegistrationToken . calledOnceWithExactly ( '123' ) ) . toBe ( true ) ;
141+ } ) ;
142+
143+ it ( 'should not call the native method setPushNotificationRegistrationToken on iOS' , ( ) => {
144+ Platform . OS = 'ios' ;
145+ Replies . setPushNotificationRegistrationTokenAndroid ( true ) ;
146+
147+ expect ( setPushNotificationRegistrationToken . notCalled ) . toBe ( true ) ;
148+ } ) ;
149+
129150
151+ it ( 'should call the native method setNotificationIcon on Android' , ( ) => {
130152 Platform . OS = 'android' ;
131- Replies . setPushNotificationsEnabled ( true ) ;
153+ Replies . setNotificationIconAndroid ( 123 ) ;
154+
155+ expect ( setNotificationIcon . calledOnceWithExactly ( 123 ) ) . toBe ( true ) ;
156+ } ) ;
132157
133- expect ( setPushNotificationsEnabled . notCalled ) . toBe ( true ) ;
158+ it ( 'should not call the native method setNotificationIcon on iOS' , ( ) => {
159+ Platform . OS = 'ios' ;
160+ Replies . setNotificationIconAndroid ( 123 ) ;
134161
162+ expect ( setNotificationIcon . notCalled ) . toBe ( true ) ;
135163 } ) ;
136164
137165
166+ it ( 'should call the native method setPushNotificationChannelId on Android' , ( ) => {
167+ Platform . OS = 'android' ;
168+ Replies . setPushNotificationChannelIdAndroid ( '123' ) ;
169+
170+ expect ( setPushNotificationChannelId . calledOnceWithExactly ( '123' ) ) . toBe ( true ) ;
171+ } ) ;
172+
173+ it ( 'should not call the native method setPushNotificationChannelId on iOS' , ( ) => {
174+ Platform . OS = 'ios' ;
175+ Replies . setPushNotificationChannelIdAndroid ( '123' ) ;
176+
177+ expect ( setPushNotificationChannelId . notCalled ) . toBe ( true ) ;
178+ } ) ;
179+
180+
181+ it ( 'should call the native method setSystemReplyNotificationSoundEnabled on Android' , ( ) => {
182+ Platform . OS = 'android' ;
183+ Replies . setSystemReplyNotificationSoundEnabledAndroid ( true ) ;
184+
185+ expect ( setSystemReplyNotificationSoundEnabled . calledOnceWithExactly ( true ) ) . toBe ( true ) ;
186+ } ) ;
187+
188+ it ( 'should not call the native method setSystemReplyNotificationSoundEnabled on iOS' , ( ) => {
189+ Platform . OS = 'ios' ;
190+ Replies . setSystemReplyNotificationSoundEnabledAndroid ( true ) ;
191+
192+ expect ( setSystemReplyNotificationSoundEnabled . notCalled ) . toBe ( true ) ;
193+ } ) ;
194+
138195} ) ;
0 commit comments