@@ -87,6 +87,9 @@ describe('AwsXrayRemoteSampler', () => {
8787 ) . toEqual ( SamplingDecision . NOT_RECORD ) ;
8888
8989 setTimeout ( ( ) => {
90+ // restore function
91+ ( AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
92+
9093 expect (
9194 sampler . shouldSample ( context . active ( ) , '1234' , 'name' , SpanKind . CLIENT , { abc : '1234' } , [ ] ) . decision
9295 ) . toEqual ( SamplingDecision . RECORD_AND_SAMPLED ) ;
@@ -97,8 +100,6 @@ describe('AwsXrayRemoteSampler', () => {
97100 sampler . shouldSample ( context . active ( ) , '1234' , 'name' , SpanKind . CLIENT , { abc : '1234' } , [ ] ) . decision
98101 ) . toEqual ( SamplingDecision . RECORD_AND_SAMPLED ) ;
99102
100- // reset function
101- ( AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
102103 done ( ) ;
103104 } , 300 ) ;
104105 } , 10 ) ;
@@ -138,12 +139,14 @@ describe('AwsXrayRemoteSampler', () => {
138139 sampled ++ ;
139140 }
140141 }
142+
143+ // restore function
144+ ( AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
145+
141146 expect ( ( ( ( sampler as any ) . ruleCache as any ) . ruleAppliers [ 0 ] as any ) . reservoirSampler . _root . quota ) . toEqual (
142147 100000
143148 ) ;
144149 expect ( sampled ) . toEqual ( 100000 ) ;
145- // reset function
146- ( AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
147150 done ( ) ;
148151 } , 2000 ) ;
149152 } , 100 ) ;
@@ -185,13 +188,13 @@ describe('AwsXrayRemoteSampler', () => {
185188 sampled ++ ;
186189 }
187190 }
188- expect ( sampled ) . toEqual ( 100 ) ;
189- // reset function
190- ( AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
191191 clock . restore ( ) ;
192+ // restore function
193+ ( AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
194+ expect ( sampled ) . toEqual ( 100 ) ;
192195 done ( ) ;
193196 } , 2000 ) ;
194- } , 100 ) ;
197+ } , 300 ) ;
195198 } ) ;
196199
197200 it ( 'generates valid ClientId' , ( ) => {
0 commit comments