@@ -16,7 +16,7 @@ import FetchHttpClient, {
1616 IUniversalFlagConfigResponse ,
1717} from './http-client' ;
1818import { StoreBackedConfiguration } from './i-configuration' ;
19- import { BanditParameters , BanditVariation , Flag , VariationType } from './interfaces' ;
19+ import { BanditParameters , BanditVariation , Flag } from './interfaces' ;
2020
2121describe ( 'ConfigurationRequestor' , ( ) => {
2222 let flagStore : IConfigurationStore < Flag > ;
@@ -588,139 +588,5 @@ describe('ConfigurationRequestor', () => {
588588 expect ( fetchSpy . mock . calls . length ) . toBe ( 1 ) ;
589589 } ) ;
590590 } ) ;
591-
592- describe ( 'IConfigurationStore updates' , ( ) => {
593- it ( 'should update configuration when stores are changed' , async ( ) => {
594- // Create new stores
595- const newFlagStore = new MemoryOnlyConfigurationStore < Flag > ( ) ;
596- const newBanditVariationStore = new MemoryOnlyConfigurationStore < BanditVariation [ ] > ( ) ;
597- const newBanditModelStore = new MemoryOnlyConfigurationStore < BanditParameters > ( ) ;
598-
599- // Add a test flag to the new flag store
600- await newFlagStore . setEntries ( {
601- 'test-flag' : {
602- key : 'test-flag' ,
603- enabled : true ,
604- variationType : VariationType . STRING ,
605- variations : {
606- control : { key : 'control' , value : 'control-value' } ,
607- treatment : { key : 'treatment' , value : 'treatment-value' } ,
608- } ,
609- allocations : [
610- {
611- key : 'allocation-1' ,
612- rules : [ ] ,
613- splits : [
614- {
615- shards : [ { salt : '' , ranges : [ { start : 0 , end : 10000 } ] } ] ,
616- variationKey : 'treatment' ,
617- } ,
618- ] ,
619- doLog : true ,
620- } ,
621- ] ,
622- totalShards : 10000 ,
623- } ,
624- } ) ;
625-
626- await newBanditModelStore . setEntries ( {
627- 'test-bandit' : {
628- banditKey : 'test-bandt' ,
629- modelVersion : 'v123' ,
630- modelName : 'falcon' ,
631- modelData : {
632- coefficients : { } ,
633- gamma : 0 ,
634- defaultActionScore : 0 ,
635- actionProbabilityFloor : 0 ,
636- } ,
637- } ,
638- } ) ;
639-
640- // Get the configuration and verify it has the test flag
641- const initialConfig = configurationRequestor . getConfiguration ( ) ;
642- expect ( initialConfig . getFlagKeys ( ) ) . toEqual ( [ ] ) ;
643- expect ( Object . keys ( initialConfig . getBandits ( ) ) ) . toEqual ( [ ] ) ;
644-
645- // Update the stores
646- configurationRequestor . setConfigurationStores (
647- newFlagStore ,
648- newBanditVariationStore ,
649- newBanditModelStore ,
650- ) ;
651-
652- // Get the configuration and verify it has the test flag
653- const config = configurationRequestor . getConfiguration ( ) ;
654- expect ( config . getFlagKeys ( ) ) . toEqual ( [ 'test-flag' ] ) ;
655- expect ( Object . keys ( config . getBandits ( ) ) ) . toEqual ( [ 'test-bandit' ] ) ;
656- } ) ;
657- } ) ;
658-
659- describe ( 'IConfigurationStore updates' , ( ) => {
660- it ( 'should update configuration when stores are changed' , async ( ) => {
661- // Create new stores
662- const newFlagStore = new MemoryOnlyConfigurationStore < Flag > ( ) ;
663- const newBanditVariationStore = new MemoryOnlyConfigurationStore < BanditVariation [ ] > ( ) ;
664- const newBanditModelStore = new MemoryOnlyConfigurationStore < BanditParameters > ( ) ;
665-
666- // Add a test flag to the new flag store
667- await newFlagStore . setEntries ( {
668- 'test-flag' : {
669- key : 'test-flag' ,
670- enabled : true ,
671- variationType : VariationType . STRING ,
672- variations : {
673- control : { key : 'control' , value : 'control-value' } ,
674- treatment : { key : 'treatment' , value : 'treatment-value' } ,
675- } ,
676- allocations : [
677- {
678- key : 'allocation-1' ,
679- rules : [ ] ,
680- splits : [
681- {
682- shards : [ { salt : '' , ranges : [ { start : 0 , end : 10000 } ] } ] ,
683- variationKey : 'treatment' ,
684- } ,
685- ] ,
686- doLog : true ,
687- } ,
688- ] ,
689- totalShards : 10000 ,
690- } ,
691- } ) ;
692-
693- await newBanditModelStore . setEntries ( {
694- 'test-bandit' : {
695- banditKey : 'test-bandt' ,
696- modelVersion : 'v123' ,
697- modelName : 'falcon' ,
698- modelData : {
699- coefficients : { } ,
700- gamma : 0 ,
701- defaultActionScore : 0 ,
702- actionProbabilityFloor : 0 ,
703- } ,
704- } ,
705- } ) ;
706-
707- // Get the configuration and verify it has the test flag
708- const initialConfig = configurationRequestor . getConfiguration ( ) ;
709- expect ( initialConfig . getFlagKeys ( ) ) . toEqual ( [ ] ) ;
710- expect ( Object . keys ( initialConfig . getBandits ( ) ) ) . toEqual ( [ ] ) ;
711-
712- // Update the stores
713- configurationRequestor . setConfigurationStores (
714- newFlagStore ,
715- newBanditVariationStore ,
716- newBanditModelStore ,
717- ) ;
718-
719- // Get the configuration and verify it has the test flag
720- const config = configurationRequestor . getConfiguration ( ) ;
721- expect ( config . getFlagKeys ( ) ) . toEqual ( [ 'test-flag' ] ) ;
722- expect ( Object . keys ( config . getBandits ( ) ) ) . toEqual ( [ 'test-bandit' ] ) ;
723- } ) ;
724- } ) ;
725591 } ) ;
726592} ) ;
0 commit comments