@@ -385,3 +385,52 @@ func TestOptimizelyClientWithNoTracer(t *testing.T) {
385
385
tracer := optimizelyClient .tracer .(* tracing.NoopTracer )
386
386
assert .NotNil (t , tracer )
387
387
}
388
+
389
+ func TestConvertDecideOptionsWithCMABOptions (t * testing.T ) {
390
+ // Test with IgnoreCMABCache option
391
+ options := []decide.OptimizelyDecideOptions {decide .IgnoreCMABCache }
392
+ convertedOptions := convertDecideOptions (options )
393
+ assert .True (t , convertedOptions .IgnoreCMABCache )
394
+ assert .False (t , convertedOptions .ResetCMABCache )
395
+ assert .False (t , convertedOptions .InvalidateUserCMABCache )
396
+
397
+ // Test with ResetCMABCache option
398
+ options = []decide.OptimizelyDecideOptions {decide .ResetCMABCache }
399
+ convertedOptions = convertDecideOptions (options )
400
+ assert .False (t , convertedOptions .IgnoreCMABCache )
401
+ assert .True (t , convertedOptions .ResetCMABCache )
402
+ assert .False (t , convertedOptions .InvalidateUserCMABCache )
403
+
404
+ // Test with InvalidateUserCMABCache option
405
+ options = []decide.OptimizelyDecideOptions {decide .InvalidateUserCMABCache }
406
+ convertedOptions = convertDecideOptions (options )
407
+ assert .False (t , convertedOptions .IgnoreCMABCache )
408
+ assert .False (t , convertedOptions .ResetCMABCache )
409
+ assert .True (t , convertedOptions .InvalidateUserCMABCache )
410
+
411
+ // Test with all CMAB options
412
+ options = []decide.OptimizelyDecideOptions {
413
+ decide .IgnoreCMABCache ,
414
+ decide .ResetCMABCache ,
415
+ decide .InvalidateUserCMABCache ,
416
+ }
417
+ convertedOptions = convertDecideOptions (options )
418
+ assert .True (t , convertedOptions .IgnoreCMABCache )
419
+ assert .True (t , convertedOptions .ResetCMABCache )
420
+ assert .True (t , convertedOptions .InvalidateUserCMABCache )
421
+
422
+ // Test with CMAB options mixed with other options
423
+ options = []decide.OptimizelyDecideOptions {
424
+ decide .DisableDecisionEvent ,
425
+ decide .IgnoreCMABCache ,
426
+ decide .EnabledFlagsOnly ,
427
+ decide .ResetCMABCache ,
428
+ decide .InvalidateUserCMABCache ,
429
+ }
430
+ convertedOptions = convertDecideOptions (options )
431
+ assert .True (t , convertedOptions .DisableDecisionEvent )
432
+ assert .True (t , convertedOptions .EnabledFlagsOnly )
433
+ assert .True (t , convertedOptions .IgnoreCMABCache )
434
+ assert .True (t , convertedOptions .ResetCMABCache )
435
+ assert .True (t , convertedOptions .InvalidateUserCMABCache )
436
+ }
0 commit comments