@@ -68,8 +68,7 @@ void main() {
68
68
log.clear ();
69
69
});
70
70
71
- test ('startWithToken:invocationEvents: should be called on iOS' ,
72
- () async {
71
+ test ('startWithToken:invocationEvents: should be called on iOS' , () async {
73
72
when (mockPlatform.isIOS ()).thenAnswer ((_) => true );
74
73
75
74
Instabug .start (appToken, invocationEvents);
@@ -433,6 +432,51 @@ void main() {
433
432
]);
434
433
});
435
434
435
+ test ('setShakingThresholdForiPhone: Test' , () async {
436
+ const iPhoneShakingThreshold = 1.6 ;
437
+ final List <dynamic > args = < dynamic > [iPhoneShakingThreshold];
438
+
439
+ when (mockPlatform.isIOS ()).thenAnswer ((_) => true );
440
+
441
+ BugReporting .setShakingThresholdForiPhone (iPhoneShakingThreshold);
442
+ expect (log, < Matcher > [
443
+ isMethodCall (
444
+ 'setShakingThresholdForiPhone:' ,
445
+ arguments: args,
446
+ )
447
+ ]);
448
+ });
449
+
450
+ test ('setShakingThresholdForiPad: Test' , () async {
451
+ const iPadShakingThreshold = 1.6 ;
452
+ final List <dynamic > args = < dynamic > [iPadShakingThreshold];
453
+
454
+ when (mockPlatform.isIOS ()).thenAnswer ((_) => true );
455
+
456
+ BugReporting .setShakingThresholdForiPad (iPadShakingThreshold);
457
+ expect (log, < Matcher > [
458
+ isMethodCall (
459
+ 'setShakingThresholdForiPad:' ,
460
+ arguments: args,
461
+ )
462
+ ]);
463
+ });
464
+
465
+ test ('setShakingThresholdForAndroid: Test' , () async {
466
+ const androidThreshold = 1000 ;
467
+ final List <dynamic > args = < dynamic > [androidThreshold];
468
+
469
+ when (mockPlatform.isAndroid ()).thenAnswer ((_) => true );
470
+
471
+ BugReporting .setShakingThresholdForAndroid (androidThreshold);
472
+ expect (log, < Matcher > [
473
+ isMethodCall (
474
+ 'setShakingThresholdForAndroid:' ,
475
+ arguments: args,
476
+ )
477
+ ]);
478
+ });
479
+
436
480
test ('setOnInvokeCallback Test' , () async {
437
481
BugReporting .setOnInvokeCallback (() => () {});
438
482
expect (log, < Matcher > [
@@ -467,6 +511,17 @@ void main() {
467
511
]);
468
512
});
469
513
514
+ test ('setInvocationEvents Test' , () async {
515
+ BugReporting .setInvocationEvents (null );
516
+ final List <dynamic > args = < dynamic > [< String > []];
517
+ expect (log, < Matcher > [
518
+ isMethodCall (
519
+ 'setInvocationEvents:' ,
520
+ arguments: args,
521
+ )
522
+ ]);
523
+ });
524
+
470
525
test (
471
526
'setEnabledAttachmentTypes:extraScreenShot:galleryImage:screenRecording: Test' ,
472
527
() async {
@@ -521,6 +576,17 @@ void main() {
521
576
]);
522
577
});
523
578
579
+ test ('setInvocationOptions Test: empty' , () async {
580
+ BugReporting .setInvocationOptions (null );
581
+ final List <dynamic > args = < dynamic > [< String > []];
582
+ expect (log, < Matcher > [
583
+ isMethodCall (
584
+ 'setInvocationOptions:' ,
585
+ arguments: args,
586
+ )
587
+ ]);
588
+ });
589
+
524
590
test ('showBugReportingWithReportTypeAndOptions:options Test' , () async {
525
591
BugReporting .show (
526
592
ReportType .bug, < InvocationOption > [InvocationOption .emailFieldHidden]);
@@ -536,6 +602,18 @@ void main() {
536
602
]);
537
603
});
538
604
605
+ test ('showBugReportingWithReportTypeAndOptions:options Test: empty options' ,
606
+ () async {
607
+ BugReporting .show (ReportType .bug, null );
608
+ final List <dynamic > args = < dynamic > [ReportType .bug.toString (), < String > []];
609
+ expect (log, < Matcher > [
610
+ isMethodCall (
611
+ 'showBugReportingWithReportTypeAndOptions:options:' ,
612
+ arguments: args,
613
+ )
614
+ ]);
615
+ });
616
+
539
617
test ('setSurveysEnabled: Test' , () async {
540
618
const isEnabled = false ;
541
619
final List <dynamic > args = < dynamic > [isEnabled];
@@ -626,6 +704,21 @@ void main() {
626
704
]);
627
705
});
628
706
707
+ test ('setAppStoreURL Test' , () async {
708
+ const appStoreURL = 'appStoreURL' ;
709
+ final List <dynamic > args = < dynamic > [appStoreURL];
710
+
711
+ when (mockPlatform.isIOS ()).thenAnswer ((_) => true );
712
+
713
+ Surveys .setAppStoreURL (appStoreURL);
714
+ expect (log, < Matcher > [
715
+ isMethodCall (
716
+ 'setAppStoreURL:' ,
717
+ arguments: args,
718
+ )
719
+ ]);
720
+ });
721
+
629
722
test ('showFeatureRequests Test' , () async {
630
723
FeatureRequests .show ();
631
724
expect (
@@ -677,6 +770,21 @@ void main() {
677
770
]);
678
771
});
679
772
773
+ test ('setInAppNotificationSound: Test' , () async {
774
+ const isEnabled = false ;
775
+ final List <dynamic > args = < dynamic > [isEnabled];
776
+
777
+ when (mockPlatform.isAndroid ()).thenAnswer ((_) => true );
778
+
779
+ Replies .setInAppNotificationSound (isEnabled);
780
+ expect (log, < Matcher > [
781
+ isMethodCall (
782
+ 'setEnableInAppNotificationSound:' ,
783
+ arguments: args,
784
+ )
785
+ ]);
786
+ });
787
+
680
788
test ('showReplies Test' , () async {
681
789
Replies .show ();
682
790
expect (log, < Matcher > [isMethodCall ('showReplies' , arguments: null )]);
@@ -751,17 +859,4 @@ void main() {
751
859
]);
752
860
}
753
861
});
754
-
755
- ///Since the below method only runs on android and has the [Platform.isAndroid] condition in it, it will fail when running outside android,
756
- /// therefore its commented.
757
- // test('setEnableInAppNotificationSound: Test', () async {
758
- // bool isEnabled = false;
759
- // final List<dynamic> args = <dynamic>[isEnabled];
760
- // Replies.setInAppNotificationSound(isEnabled);
761
- // expect(log, <Matcher>[
762
- // isMethodCall('setEnableInAppNotificationSound:',
763
- // arguments: args,
764
- // )
765
- // ]);
766
- // });
767
862
}
0 commit comments