@@ -752,8 +752,7 @@ describe('RemoteConfig', () => {
752
752
}
753
753
} ;
754
754
755
- describe ( 'load' , ( ) => {
756
- const operationName = 'getServerTemplate' ;
755
+ describe ( 'set' , ( ) => {
757
756
const INVALID_PARAMETERS : any [ ] = [ null , '' , 'abc' , 1 , true , [ ] ] ;
758
757
const INVALID_CONDITIONS : any [ ] = [ null , '' , 'abc' , 1 , true , { } ] ;
759
758
let sourceTemplate = deepCopy ( SERVER_REMOTE_CONFIG_RESPONSE ) ;
@@ -770,7 +769,7 @@ describe('RemoteConfig', () => {
770
769
}
771
770
} ;
772
771
const initializedTemplate = remoteConfig . initServerTemplate ( ) ;
773
- initializedTemplate . load ( template ) ;
772
+ initializedTemplate . set ( template ) ;
774
773
const parsed = initializedTemplate . toJSON ( ) ;
775
774
const expectedVersion = deepCopy ( VERSION_INFO ) ;
776
775
expectedVersion . updateTime = new Date ( expectedVersion . updateTime ) . toUTCString ( ) ;
@@ -791,7 +790,7 @@ describe('RemoteConfig', () => {
791
790
} ;
792
791
const templateJson = JSON . stringify ( template ) ;
793
792
const initializedTemplate = remoteConfig . initServerTemplate ( ) ;
794
- initializedTemplate . load ( templateJson ) ;
793
+ initializedTemplate . set ( templateJson ) ;
795
794
const parsed = initializedTemplate . toJSON ( ) ;
796
795
const expectedVersion = deepCopy ( VERSION_INFO ) ;
797
796
expectedVersion . updateTime = new Date ( expectedVersion . updateTime ) . toUTCString ( ) ;
@@ -802,7 +801,7 @@ describe('RemoteConfig', () => {
802
801
it ( 'should throw if template is an invalid JSON' , ( ) => {
803
802
const jsonString = '{invalidJson: null}' ;
804
803
const initializedTemplate = remoteConfig . initServerTemplate ( ) ;
805
- expect ( ( ) => initializedTemplate . load ( jsonString ) )
804
+ expect ( ( ) => initializedTemplate . set ( jsonString ) )
806
805
. to . throw ( / F a i l e d t o p a r s e t h e J S O N s t r i n g : ( [ \D \w ] * ) \. / ) ;
807
806
} ) ;
808
807
@@ -811,7 +810,7 @@ describe('RemoteConfig', () => {
811
810
it ( `should throw if the parameters is ${ JSON . stringify ( invalidParameter ) } ` , ( ) => {
812
811
const jsonString = JSON . stringify ( sourceTemplate ) ;
813
812
const initializedTemplate = remoteConfig . initServerTemplate ( ) ;
814
- expect ( ( ) => initializedTemplate . load ( jsonString ) )
813
+ expect ( ( ) => initializedTemplate . set ( jsonString ) )
815
814
. to . throw ( / F a i l e d t o p a r s e t h e J S O N s t r i n g : ( [ \D \w ] * ) \. / ) ;
816
815
} ) ;
817
816
} ) ;
@@ -822,11 +821,16 @@ describe('RemoteConfig', () => {
822
821
it ( `should throw if the conditions is ${ JSON . stringify ( invalidConditions ) } ` , ( ) => {
823
822
const jsonString = JSON . stringify ( sourceTemplate ) ;
824
823
const initializedTemplate = remoteConfig . initServerTemplate ( ) ;
825
- expect ( ( ) => initializedTemplate . load ( jsonString ) )
824
+ expect ( ( ) => initializedTemplate . set ( jsonString ) )
826
825
. to . throw ( / F a i l e d t o p a r s e t h e J S O N s t r i n g : ( [ \D \w ] * ) \. / ) ;
827
826
} ) ;
828
827
} ) ;
829
828
829
+ } ) ;
830
+
831
+ describe ( 'load' , ( ) => {
832
+ const operationName = 'getServerTemplate' ;
833
+
830
834
it ( 'should propagate API errors' , ( ) => {
831
835
const stub = sinon
832
836
. stub ( RemoteConfigApiClient . prototype , operationName )
@@ -1248,7 +1252,7 @@ describe('RemoteConfig', () => {
1248
1252
} ,
1249
1253
}
1250
1254
1251
- template . load ( response as ServerTemplateData ) ;
1255
+ template . set ( response as ServerTemplateData ) ;
1252
1256
1253
1257
let config = template . evaluate ( ) ;
1254
1258
@@ -1263,7 +1267,7 @@ describe('RemoteConfig', () => {
1263
1267
} ,
1264
1268
}
1265
1269
1266
- template . load ( response as ServerTemplateData ) ;
1270
+ template . set ( response as ServerTemplateData ) ;
1267
1271
1268
1272
config = template . evaluate ( ) ;
1269
1273
0 commit comments