@@ -68,8 +68,7 @@ void main() {
6868 log.clear ();
6969 });
7070
71- test ('startWithToken:invocationEvents: should be called on iOS' ,
72- () async {
71+ test ('startWithToken:invocationEvents: should be called on iOS' , () async {
7372 when (mockPlatform.isIOS ()).thenAnswer ((_) => true );
7473
7574 Instabug .start (appToken, invocationEvents);
@@ -433,6 +432,51 @@ void main() {
433432 ]);
434433 });
435434
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+
436480 test ('setOnInvokeCallback Test' , () async {
437481 BugReporting .setOnInvokeCallback (() => () {});
438482 expect (log, < Matcher > [
@@ -467,6 +511,17 @@ void main() {
467511 ]);
468512 });
469513
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+
470525 test (
471526 'setEnabledAttachmentTypes:extraScreenShot:galleryImage:screenRecording: Test' ,
472527 () async {
@@ -521,6 +576,17 @@ void main() {
521576 ]);
522577 });
523578
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+
524590 test ('showBugReportingWithReportTypeAndOptions:options Test' , () async {
525591 BugReporting .show (
526592 ReportType .bug, < InvocationOption > [InvocationOption .emailFieldHidden]);
@@ -536,6 +602,18 @@ void main() {
536602 ]);
537603 });
538604
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+
539617 test ('setSurveysEnabled: Test' , () async {
540618 const isEnabled = false ;
541619 final List <dynamic > args = < dynamic > [isEnabled];
@@ -626,6 +704,21 @@ void main() {
626704 ]);
627705 });
628706
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+
629722 test ('showFeatureRequests Test' , () async {
630723 FeatureRequests .show ();
631724 expect (
@@ -677,6 +770,21 @@ void main() {
677770 ]);
678771 });
679772
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+
680788 test ('showReplies Test' , () async {
681789 Replies .show ();
682790 expect (log, < Matcher > [isMethodCall ('showReplies' , arguments: null )]);
@@ -751,17 +859,4 @@ void main() {
751859 ]);
752860 }
753861 });
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- // });
767862}
0 commit comments