1- import { createSplitRegistry } from './splitRegistry' ;
1+ import { createSplitRegistry , NULL_SPLIT_REGISTRY } from './splitRegistry' ;
22
33function setupSplitRegistry ( ) {
44 return createSplitRegistry ( [
@@ -15,18 +15,14 @@ describe('SplitRegistry', () => {
1515 expect ( split ! . name ) . toEqual ( 'split1' ) ;
1616 expect ( split ! . isFeatureGate ) . toEqual ( true ) ;
1717 expect ( split ! . weighting ) . toEqual ( { foo : 50 , bar : 50 , baz : 0 } ) ;
18-
1918 expect ( splitRegistry . getSplit ( 'unknown split' ) ) . toEqual ( undefined ) ;
2019 } ) ;
2120 } ) ;
2221
2322 describe ( '.isLoaded' , ( ) => {
24- it ( 'is not loaded if null is passed in ' , ( ) => {
23+ it ( 'is loaded when splits are provided ' , ( ) => {
2524 const splitRegistry = setupSplitRegistry ( ) ;
26- expect ( splitRegistry . isLoaded ) . toEqual ( true ) ;
27-
28- const notLoadedRegistry = createSplitRegistry ( null ) ;
29- expect ( notLoadedRegistry . isLoaded ) . toEqual ( false ) ;
25+ expect ( splitRegistry . isLoaded ) . toBe ( true ) ;
3026 } ) ;
3127 } ) ;
3228
@@ -37,3 +33,11 @@ describe('SplitRegistry', () => {
3733 } ) ;
3834 } ) ;
3935} ) ;
36+
37+ describe ( 'NULL_SPLIT_REGISTRY' , ( ) => {
38+ it ( 'provides a null implementation' , ( ) => {
39+ expect ( NULL_SPLIT_REGISTRY . isLoaded ) . toBe ( false ) ;
40+ expect ( NULL_SPLIT_REGISTRY . getSplit ( 'foo' ) ) . toBeUndefined ( ) ;
41+ expect ( NULL_SPLIT_REGISTRY . asV1Hash ( ) ) . toBeUndefined ( ) ;
42+ } ) ;
43+ } ) ;
0 commit comments