File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,22 @@ describe('ConfigLoader', () => {
148148
149149 expect ( spy . calledOnce ) . to . be . true ; // Should only emit once
150150 } ) ;
151+
152+ it ( 'should not emit event if configurationSources is disabled' , async ( ) => {
153+ const config = {
154+ configurationSources : {
155+ enabled : false ,
156+ } ,
157+ } ;
158+
159+ configLoader = new ConfigLoader ( config ) ;
160+ const spy = sinon . spy ( ) ;
161+ configLoader . on ( 'configurationChanged' , spy ) ;
162+
163+ await configLoader . reloadConfiguration ( ) ;
164+
165+ expect ( spy . called ) . to . be . false ;
166+ } ) ;
151167 } ) ;
152168
153169 describe ( 'initialize' , ( ) => {
@@ -250,6 +266,28 @@ describe('ConfigLoader', () => {
250266
251267 expect ( spy . callCount ) . to . greaterThan ( 1 ) ;
252268 } ) ;
269+
270+ it ( 'should clear the interval when stop is called' , async ( ) => {
271+ const mockConfig = {
272+ configurationSources : {
273+ enabled : true ,
274+ sources : [
275+ {
276+ type : 'file' ,
277+ enabled : true ,
278+ path : tempConfigFile ,
279+ } ,
280+ ] ,
281+ } ,
282+ } ;
283+
284+ const configLoader = new ConfigLoader ( mockConfig ) ;
285+ configLoader . reloadTimer = setInterval ( ( ) => { } , 1000 ) ;
286+ expect ( configLoader . reloadTimer ) . to . not . be . null ;
287+
288+ await configLoader . stop ( ) ;
289+ expect ( configLoader . reloadTimer ) . to . be . null ;
290+ } ) ;
253291 } ) ;
254292
255293 describe ( 'loadRemoteConfig' , ( ) => {
You can’t perform that action at this time.
0 commit comments