@@ -4505,6 +4505,15 @@ describe('lib/optimizely', function() {
4505
4505
} ) ;
4506
4506
4507
4507
it ( 'should make a decision for feature_test and dispatch an event' , function ( ) {
4508
+ const { optlyInstance, eventDispatcher } = getOptlyInstance (
4509
+ {
4510
+ datafileObj : testData . getTestDecideProjectConfig ( ) ,
4511
+ }
4512
+ ) ;
4513
+
4514
+ const notificationCenter = optlyInstance . notificationCenter ;
4515
+ sinon . stub ( notificationCenter , 'sendNotifications' ) ;
4516
+
4508
4517
var flagKey = 'feature_2' ;
4509
4518
var expectedVariables = optlyInstance . getAllFeatureVariables ( flagKey , userId ) ;
4510
4519
var user = new OptimizelyUserContext ( {
@@ -4600,6 +4609,15 @@ describe('lib/optimizely', function() {
4600
4609
} ) ;
4601
4610
4602
4611
it ( 'should make a decision and do not dispatch an event with DISABLE_DECISION_EVENT passed in decide options' , function ( ) {
4612
+ const { optlyInstance, eventDispatcher } = getOptlyInstance (
4613
+ {
4614
+ datafileObj : testData . getTestDecideProjectConfig ( ) ,
4615
+ }
4616
+ ) ;
4617
+
4618
+ const notificationCenter = optlyInstance . notificationCenter ;
4619
+ sinon . stub ( notificationCenter , 'sendNotifications' ) ;
4620
+
4603
4621
var flagKey = 'feature_2' ;
4604
4622
var expectedVariables = optlyInstance . getAllFeatureVariables ( flagKey , userId ) ;
4605
4623
var user = new OptimizelyUserContext ( {
@@ -4641,6 +4659,15 @@ describe('lib/optimizely', function() {
4641
4659
} ) ;
4642
4660
4643
4661
it ( 'should make a decision with excluded variables and do not dispatch an event with DISABLE_DECISION_EVENT and EXCLUDE_VARIABLES passed in decide options' , function ( ) {
4662
+ const { optlyInstance, eventDispatcher } = getOptlyInstance (
4663
+ {
4664
+ datafileObj : testData . getTestDecideProjectConfig ( ) ,
4665
+ }
4666
+ ) ;
4667
+
4668
+ const notificationCenter = optlyInstance . notificationCenter ;
4669
+ sinon . stub ( notificationCenter , 'sendNotifications' ) ;
4670
+
4644
4671
var flagKey = 'feature_2' ;
4645
4672
var user = new OptimizelyUserContext ( {
4646
4673
optimizely : optlyInstance ,
@@ -4684,11 +4711,15 @@ describe('lib/optimizely', function() {
4684
4711
} ) ;
4685
4712
4686
4713
it ( 'should make a decision for rollout and dispatch an event when sendFlagDecisions is set to true' , function ( ) {
4687
- const { optlyInstance, notificationCenter , eventDispatcher } = getOptlyInstance (
4714
+ const { optlyInstance, eventDispatcher } = getOptlyInstance (
4688
4715
{
4689
4716
datafileObj : testData . getTestDecideProjectConfig ( ) ,
4690
4717
}
4691
- )
4718
+ ) ;
4719
+
4720
+ const notificationCenter = optlyInstance . notificationCenter ;
4721
+ sinon . stub ( notificationCenter , 'sendNotifications' ) ;
4722
+
4692
4723
var flagKey = 'feature_1' ;
4693
4724
var expectedVariables = optlyInstance . getAllFeatureVariables ( flagKey , userId ) ;
4694
4725
var user = new OptimizelyUserContext ( {
@@ -4730,11 +4761,14 @@ describe('lib/optimizely', function() {
4730
4761
} ) ;
4731
4762
4732
4763
it ( 'should make a decision for rollout and do not dispatch an event when sendFlagDecisions is set to false' , function ( ) {
4733
- const { optlyInstance, notificationCenter , eventDispatcher } = getOptlyInstance (
4764
+ const { optlyInstance, eventDispatcher } = getOptlyInstance (
4734
4765
{
4735
4766
datafileObj : testData . getTestDecideProjectConfig ( ) ,
4736
4767
}
4737
- )
4768
+ ) ;
4769
+
4770
+ const notificationCenter = optlyInstance . notificationCenter ;
4771
+ sinon . stub ( notificationCenter , 'sendNotifications' ) ;
4738
4772
4739
4773
var newConfig = optlyInstance . projectConfigManager . getConfig ( ) ;
4740
4774
newConfig . sendFlagDecisions = false ;
@@ -4780,11 +4814,15 @@ describe('lib/optimizely', function() {
4780
4814
} ) ;
4781
4815
4782
4816
it ( 'should make a decision when variation is null and dispatch an event' , function ( ) {
4783
- const { optlyInstance, notificationCenter , eventDispatcher } = getOptlyInstance (
4817
+ const { optlyInstance, eventDispatcher } = getOptlyInstance (
4784
4818
{
4785
4819
datafileObj : testData . getTestDecideProjectConfig ( ) ,
4786
4820
}
4787
- )
4821
+ ) ;
4822
+
4823
+ const notificationCenter = optlyInstance . notificationCenter ;
4824
+ sinon . stub ( notificationCenter , 'sendNotifications' ) ;
4825
+
4788
4826
var flagKey = 'feature_3' ;
4789
4827
var expectedVariables = optlyInstance . getAllFeatureVariables ( flagKey , userId ) ;
4790
4828
var user = new OptimizelyUserContext ( {
@@ -4828,10 +4866,14 @@ describe('lib/optimizely', function() {
4828
4866
4829
4867
describe ( 'with EXCLUDE_VARIABLES flag in default decide options' , function ( ) {
4830
4868
it ( 'should exclude variables in decision object and dispatch an event' , function ( ) {
4831
- const { optlyInstance, notificationCenter , eventDispatcher } = getOptlyInstance ( {
4869
+ const { optlyInstance, eventDispatcher } = getOptlyInstance ( {
4832
4870
datafileObj : testData . getTestDecideProjectConfig ( ) ,
4833
4871
defaultDecideOptions : [ OptimizelyDecideOption . EXCLUDE_VARIABLES ] ,
4834
- } )
4872
+ } ) ;
4873
+
4874
+ const notificationCenter = optlyInstance . notificationCenter ;
4875
+ sinon . stub ( notificationCenter , 'sendNotifications' ) ;
4876
+
4835
4877
var flagKey = 'feature_2' ;
4836
4878
var user = new OptimizelyUserContext ( {
4837
4879
optimizely : optlyInstance ,
@@ -4871,12 +4913,15 @@ describe('lib/optimizely', function() {
4871
4913
assert . deepEqual ( notificationCallArgs , expectedNotificationCallArgs ) ;
4872
4914
} ) ;
4873
4915
4874
- it . skip ( 'should exclude variables in decision object and do not dispatch an event when DISABLE_DECISION_EVENT is passed in decide options' , function ( ) {
4875
- const { optlyInstance, notificationCenter , eventDispatcher } = getOptlyInstance ( {
4916
+ it ( 'should exclude variables in decision object and do not dispatch an event when DISABLE_DECISION_EVENT is passed in decide options' , function ( ) {
4917
+ const { optlyInstance, eventDispatcher } = getOptlyInstance ( {
4876
4918
datafileObj : testData . getTestDecideProjectConfig ( ) ,
4877
4919
defaultDecideOptions : [ OptimizelyDecideOption . EXCLUDE_VARIABLES ] ,
4878
4920
} )
4879
4921
4922
+ const notificationCenter = optlyInstance . notificationCenter ;
4923
+ sinon . stub ( notificationCenter , 'sendNotifications' ) ;
4924
+
4880
4925
var flagKey = 'feature_2' ;
4881
4926
var user = new OptimizelyUserContext ( {
4882
4927
optimizely : optlyInstance ,
0 commit comments