@@ -552,16 +552,23 @@ void main() {
552552 return true ;
553553 }
554554
555- Set <OptimizelyDecideOption > options = {
555+ Set <OptimizelyDecideOption > defaultDecideOptions = {
556556 OptimizelyDecideOption .disableDecisionEvent,
557- OptimizelyDecideOption .enabledFlagsOnly,
557+ OptimizelyDecideOption .enabledFlagsOnly
558+ };
559+ Set <OptimizelyDecideOption > options = {
558560 OptimizelyDecideOption .ignoreUserProfileService,
559561 OptimizelyDecideOption .includeReasons,
560562 OptimizelyDecideOption .excludeVariables,
561563 };
562-
563564 test ("decide() should succeed" , () async {
564- var sdk = OptimizelyFlutterSdk (testSDKKey);
565+ Set <OptimizelyDecideOption > options = {
566+ OptimizelyDecideOption .ignoreUserProfileService,
567+ OptimizelyDecideOption .includeReasons,
568+ OptimizelyDecideOption .excludeVariables,
569+ };
570+ var sdk = OptimizelyFlutterSdk (testSDKKey,
571+ defaultDecideOptions: defaultDecideOptions);
565572 var userContext = await sdk.createUserContext (userId, attributes);
566573 var decideKey = "decide-key" ;
567574
@@ -573,13 +580,14 @@ void main() {
573580 TestUtils .compareDecisions (
574581 {response.decision! .flagKey: response.decision! }),
575582 equals (true ));
576- expect (decideOptions.length == 5 , isTrue);
583+ expect (decideOptions.length == 3 , isTrue);
577584 expect (assertDecideOptions (options, decideOptions), isTrue);
578585 decideOptions = [];
579586 });
580587
581588 test ("decideForKeys should succeed" , () async {
582- var sdk = OptimizelyFlutterSdk (testSDKKey);
589+ var sdk = OptimizelyFlutterSdk (testSDKKey,
590+ defaultDecideOptions: defaultDecideOptions);
583591 var userContext = await sdk.createUserContext (userId, attributes);
584592 var decideKeys = ["decide-key-1" , "decide-key-2" ];
585593
@@ -588,21 +596,22 @@ void main() {
588596 expect (response.success, isTrue);
589597 expect (response.decisions.length, equals (2 ));
590598 expect (TestUtils .compareDecisions (response.decisions), isTrue);
591- expect (decideOptions.length == 5 , isTrue);
599+ expect (decideOptions.length == 3 , isTrue);
592600 expect (assertDecideOptions (options, decideOptions), isTrue);
593601 decideOptions = [];
594602 });
595603
596604 test ("decideAll() should succeed" , () async {
597- var sdk = OptimizelyFlutterSdk (testSDKKey);
605+ var sdk = OptimizelyFlutterSdk (testSDKKey,
606+ defaultDecideOptions: defaultDecideOptions);
598607 var userContext = await sdk.createUserContext (userId, attributes);
599608
600609 var response = await userContext! .decideAll (options);
601610
602611 expect (response.success, isTrue);
603612 expect (response.decisions.length, equals (3 ));
604613 expect (TestUtils .compareDecisions (response.decisions), isTrue);
605- expect (decideOptions.length == 5 , isTrue);
614+ expect (decideOptions.length == 3 , isTrue);
606615 expect (assertDecideOptions (options, decideOptions), isTrue);
607616 decideOptions = [];
608617 });
@@ -611,8 +620,16 @@ void main() {
611620 final convertedOptions = Utils .convertDecideOptions (
612621 options,
613622 );
614- expect (convertedOptions.length == 5 , isTrue);
623+ expect (convertedOptions.length == 3 , isTrue);
615624 expect (assertDecideOptions (options, convertedOptions), isTrue);
625+ final convertedDefaultDecideOptions = Utils .convertDecideOptions (
626+ defaultDecideOptions,
627+ );
628+ expect (convertedDefaultDecideOptions.length == 2 , isTrue);
629+ expect (
630+ assertDecideOptions (
631+ defaultDecideOptions, convertedDefaultDecideOptions),
632+ isTrue);
616633 });
617634 });
618635
0 commit comments