@@ -248,6 +248,40 @@ describe('IdleTransaction', () => {
248248 } ) ;
249249
250250 describe ( 'cancelIdleTimeout' , ( ) => {
251+ it ( 'permanent idle timeout cancel is not restarted by child span start' , ( ) => {
252+ const idleTimeout = 10 ;
253+ const transaction = new IdleTransaction ( { name : 'foo' , startTimestamp : 1234 } , hub , idleTimeout ) ;
254+ transaction . initSpanRecorder ( 10 ) ;
255+
256+ const firstSpan = transaction . startChild ( { } ) ;
257+ transaction . cancelIdleTimeout ( undefined , { restartOnChildSpanChange : false } ) ;
258+ const secondSpan = transaction . startChild ( { } ) ;
259+ firstSpan . finish ( ) ;
260+ secondSpan . finish ( ) ;
261+
262+ expect ( transaction . endTimestamp ) . toBeDefined ( ) ;
263+ } ) ;
264+
265+ it ( 'permanent idle timeout cancel finished the transaction with the last child' , ( ) => {
266+ const idleTimeout = 10 ;
267+ const transaction = new IdleTransaction ( { name : 'foo' , startTimestamp : 1234 } , hub , idleTimeout ) ;
268+ transaction . initSpanRecorder ( 10 ) ;
269+
270+ const firstSpan = transaction . startChild ( { } ) ;
271+ transaction . cancelIdleTimeout ( undefined , { restartOnChildSpanChange : false } ) ;
272+ const secondSpan = transaction . startChild ( { } ) ;
273+ const thirdSpan = transaction . startChild ( { } ) ;
274+
275+ firstSpan . finish ( ) ;
276+ expect ( transaction . endTimestamp ) . toBeUndefined ( ) ;
277+
278+ secondSpan . finish ( ) ;
279+ expect ( transaction . endTimestamp ) . toBeUndefined ( ) ;
280+
281+ thirdSpan . finish ( ) ;
282+ expect ( transaction . endTimestamp ) . toBeDefined ( ) ;
283+ } ) ;
284+
251285 it ( 'permanent idle timeout cancel finishes transaction if there are no activities' , ( ) => {
252286 const idleTimeout = 10 ;
253287 const transaction = new IdleTransaction ( { name : 'foo' , startTimestamp : 1234 } , hub , idleTimeout ) ;
0 commit comments