@@ -8,13 +8,16 @@ import { UniqueIdProvider } from '../adapters/UniqueIdProvider';
88import { NotificationCategory } from '../interfaces/NotificationCategory' ;
99import { NotificationPermissions } from '../interfaces/NotificationPermissions' ;
1010import { NotificationFactory } from '../DTO/NotificationFactory' ;
11+ import { NotificationAndroid } from "../DTO/NotificationAndroid" ;
12+ import { Platform } from "react-native" ;
13+ import { NotificationIOS } from "../DTO/NotificationIOS" ;
1114
1215describe ( 'Commands' , ( ) => {
1316 let uut : Commands ;
1417 let mockedNativeCommandsSender : NativeCommandsSender ;
1518 let mockedUniqueIdProvider : UniqueIdProvider ;
1619 let notificationFactory : NotificationFactory
17-
20+
1821 beforeEach ( ( ) => {
1922 notificationFactory = new NotificationFactory ( ) ;
2023 mockedNativeCommandsSender = mock ( NativeCommandsSender ) ;
@@ -33,10 +36,21 @@ describe('Commands', () => {
3336 verify ( mockedNativeCommandsSender . getInitialNotification ( ) ) . called ( ) ;
3437 } ) ;
3538
36- it ( 'returns a promise with the initial notification' , async ( ) => {
37- const expectedNotification : Notification = new Notification ( { identifier : 'id' } ) ;
39+ it ( 'android - returns a promise with the initial notification' , async ( ) => {
40+ Platform . OS = 'android' ;
41+ const expectedNotification : Notification = new NotificationAndroid ( { 'google.message_id' : 'id' } ) ;
3842 when ( mockedNativeCommandsSender . getInitialNotification ( ) ) . thenResolve (
39- { identifier : 'id' }
43+ { 'google.message_id' : 'id' }
44+ ) ;
45+ const result = await uut . getInitialNotification ( ) ;
46+ expect ( result ) . toEqual ( expectedNotification ) ;
47+ } ) ;
48+
49+ it ( 'iOS - returns a promise with the initial notification' , async ( ) => {
50+ Platform . OS = 'ios' ;
51+ const expectedNotification : Notification = new NotificationIOS ( { identifier : 'id' } ) ;
52+ when ( mockedNativeCommandsSender . getInitialNotification ( ) ) . thenResolve (
53+ { identifier : 'id' }
4054 ) ;
4155 const result = await uut . getInitialNotification ( ) ;
4256 expect ( result ) . toEqual ( expectedNotification ) ;
@@ -99,7 +113,7 @@ describe('Commands', () => {
99113 verify ( mockedNativeCommandsSender . postLocalNotification ( notification , passedId ) ) . called ( ) ;
100114 } ) ;
101115 } ) ;
102-
116+
103117 describe ( 'getBadgeCount' , ( ) => {
104118 it ( 'sends to native' , ( ) => {
105119 uut . getBadgeCount ( ) ;
@@ -151,7 +165,7 @@ describe('Commands', () => {
151165 expect ( isRegistered ) . toEqual ( false ) ;
152166 } ) ;
153167 } ) ;
154-
168+
155169 describe ( 'checkPermissions' , ( ) => {
156170 it ( 'sends to native' , ( ) => {
157171 uut . checkPermissions ( ) ;
0 commit comments