File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,49 @@ describe('ConfigLoader', () => {
204
204
205
205
expect ( spy . calledOnce ) . to . be . true ;
206
206
} ) ;
207
+
208
+ it ( 'should clear an existing reload interval if it exists' , async ( ) => {
209
+ const mockConfig = {
210
+ configurationSources : {
211
+ enabled : true ,
212
+ sources : [
213
+ {
214
+ type : 'file' ,
215
+ enabled : true ,
216
+ path : tempConfigFile ,
217
+ } ,
218
+ ] ,
219
+ } ,
220
+ } ;
221
+
222
+ const configLoader = new ConfigLoader ( mockConfig ) ;
223
+ configLoader . reloadTimer = setInterval ( ( ) => { } , 1000 ) ;
224
+ await configLoader . start ( ) ;
225
+
226
+ expect ( configLoader . reloadTimer ) . to . be . null ;
227
+ } ) ;
228
+
229
+ it ( 'should run reloadConfiguration multiple times on short reload interval' , async ( ) => {
230
+ const mockConfig = {
231
+ configurationSources : {
232
+ enabled : true ,
233
+ sources : [
234
+ {
235
+ type : 'file' ,
236
+ enabled : true ,
237
+ path : tempConfigFile ,
238
+ } ,
239
+ ] ,
240
+ reloadIntervalSeconds : 0.001 ,
241
+ } ,
242
+ } ;
243
+
244
+ const configLoader = new ConfigLoader ( mockConfig ) ;
245
+ const spy = sinon . spy ( configLoader , 'reloadConfiguration' ) ;
246
+ await configLoader . start ( ) ;
247
+
248
+ expect ( spy . callCount ) . to . greaterThan ( 1 ) ;
249
+ } ) ;
207
250
} ) ;
208
251
209
252
describe ( 'loadRemoteConfig' , ( ) => {
You can’t perform that action at this time.
0 commit comments