@@ -88,6 +88,9 @@ describe('AwsXrayRemoteSampler', () => {
8888 ) . toEqual ( SamplingDecision . NOT_RECORD ) ;
8989
9090 setTimeout ( ( ) => {
91+ // restore function
92+ ( _AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
93+
9194 expect (
9295 sampler . shouldSample ( context . active ( ) , '1234' , 'name' , SpanKind . CLIENT , { abc : '1234' } , [ ] ) . decision
9396 ) . toEqual ( SamplingDecision . RECORD_AND_SAMPLED ) ;
@@ -98,8 +101,6 @@ describe('AwsXrayRemoteSampler', () => {
98101 sampler . shouldSample ( context . active ( ) , '1234' , 'name' , SpanKind . CLIENT , { abc : '1234' } , [ ] ) . decision
99102 ) . toEqual ( SamplingDecision . RECORD_AND_SAMPLED ) ;
100103
101- // reset function
102- ( _AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
103104 done ( ) ;
104105 } , 300 ) ;
105106 } , 10 ) ;
@@ -139,10 +140,12 @@ describe('AwsXrayRemoteSampler', () => {
139140 sampled ++ ;
140141 }
141142 }
143+
144+ // restore function
145+ ( _AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
146+
142147 expect ( ( sampler as any ) . _root . _root . ruleCache . ruleAppliers [ 0 ] . reservoirSampler . quota ) . toEqual ( 100000 ) ;
143148 expect ( sampled ) . toEqual ( 100000 ) ;
144- // reset function
145- ( _AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
146149 done ( ) ;
147150 } , 2000 ) ;
148151 } , 100 ) ;
@@ -184,13 +187,13 @@ describe('AwsXrayRemoteSampler', () => {
184187 sampled ++ ;
185188 }
186189 }
187- expect ( sampled ) . toEqual ( 100 ) ;
188- // reset function
189- ( _AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
190190 clock . restore ( ) ;
191+ // restore function
192+ ( _AwsXRayRemoteSampler . prototype as any ) . getDefaultTargetPollingInterval = tmp ;
193+ expect ( sampled ) . toEqual ( 100 ) ;
191194 done ( ) ;
192195 } , 2000 ) ;
193- } , 100 ) ;
196+ } , 300 ) ;
194197 } ) ;
195198
196199 it ( 'generates valid ClientId' , ( ) => {
0 commit comments