1+ import 'package:test/test.dart' ;
2+ import 'test_data.dart' ;
3+
4+ void main () {
5+
6+ //silent notification tests
7+ test ('expect silent notifications contentAvailable param to be true wihtout explicitly passing it into the constructor' , () {
8+ expect (silentNotification.contentAvailable, true );
9+ });
10+
11+ test ('expect notification to parse player IDs correctly' , () {
12+ expect (silentNotification.playerIds.first, testPlayerId);
13+ });
14+
15+ test ('expect notification to parse additional data correctly' , () {
16+ expect (silentNotification.additionalData['test' ], 'value' );
17+ });
18+
19+ //normal notification tests
20+ test ('expect notification content to be correct' , () {
21+ expect (notificationJson['contents' ]['es' ], 'test_content' );
22+ });
23+
24+ test ('expect notification headings to be correct' , () {
25+ expect (notificationJson['headings' ]['es' ], 'test heading' );
26+ });
27+
28+ test ('expect subtitle to be correct' , () {
29+ expect (notificationJson['subtitle' ]['es' ], 'test subtitle' );
30+ });
31+
32+ test ('expect contentAvailable to be parsed correctly' , () {
33+ expect (notificationJson['content_available' ], true );
34+ });
35+
36+ test ('expect url to be parsed correctly' , () {
37+ expect (notificationJson['url' ], 'https://www.google.com/' );
38+ });
39+
40+ test ('expect ios attahgments to be parsed correctly' , () {
41+ expect (notificationJson['ios_attachments' ]['id1' ], 'puppy.jpg' );
42+ });
43+
44+ test ('expect big picture to be parsed correctly' , () {
45+ expect (notificationJson['big_picture' ], 'puppy2.jpg' );
46+ });
47+
48+ test ('expect ios category to be parsed correctly' , () {
49+ expect (notificationJson['ios_category' ], 'test_category' );
50+ });
51+
52+ test ('expect ios sound to be parsed correctly' , () {
53+ expect (notificationJson['ios_sound' ], 'ping.aiff' );
54+ });
55+
56+ test ('expect android sound to be parsed correctly' , () {
57+ expect (notificationJson['android_sound' ], 'ping.mp3' );
58+ });
59+
60+ test ('expect android small icon to be parsed correctly' , () {
61+ expect (notificationJson['small_icon' ], 'puppy_small.jpg' );
62+ });
63+
64+ test ('expect android large icon to be parsed correctly' , () {
65+ expect (notificationJson['large_icon' ], 'puppy_large.jpg' );
66+ });
67+
68+ test ('expect android channel ID to be parsed correctly' , () {
69+ expect (notificationJson['android_channel_id' ], 'test_channel_id' );
70+ });
71+
72+ test ('expect iOS badge type to be parsed correctly' , () {
73+ expect (notificationJson['ios_badgeType' ], 'Increase' );
74+ });
75+
76+ test ('expect iOS badge count to be parsed correctly' , () {
77+ expect (notificationJson['ios_badgeCount' ], 2 );
78+ });
79+
80+ test ('expect collapse ID to be parsed correctly' , () {
81+ expect (notificationJson['collapse_id' ], 'test_collapse_id' );
82+ });
83+
84+ test ('expect sendAfter to be parsed correctly' , () {
85+ expect (notificationJson['send_after' ], "2018-07-24T20:38:24.571Z UTC00:00:00" );
86+ });
87+
88+ test ('expect delayed option to be parsed correctly' , () {
89+ expect (notificationJson['delay_option' ], 'last_active' );
90+ });
91+
92+ test ('expect delivery time of day to be parsed correctly' , () {
93+ expect (notificationJson['delivery_time_of_day' ], '9:00 AM' );
94+ });
95+
96+ test ('expect buttons to be parsed correctly' , () {
97+ var buttonsJson = notificationJson['buttons' ] as List <Map <String , dynamic >>;
98+ expect (buttonsJson.first['id' ], 'test_id' );
99+ expect (buttonsJson.first['text' ], 'test_text' );
100+ expect (buttonsJson.first['icon' ], 'test_icon' );
101+ });
102+ }
0 commit comments