File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
packages/tracing/test/browser Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,23 @@ describe('BrowserTracing', () => {
307
307
expect ( mockFinish ) . toHaveBeenCalledTimes ( 1 ) ;
308
308
} ) ;
309
309
} ) ;
310
+
311
+ describe ( 'heartbeatInterval' , ( ) => {
312
+ it ( 'can be a custom value' , ( ) => {
313
+ const interval = 200 ;
314
+ createBrowserTracing ( true , { heartbeatInterval : interval , routingInstrumentation : customInstrumentRouting } ) ;
315
+ const mockFinish = jest . fn ( ) ;
316
+ const transaction = getActiveTransaction ( hub ) as IdleTransaction ;
317
+ transaction . finish = mockFinish ;
318
+
319
+ const span = transaction . startChild ( ) ; // activities = 1
320
+ span . finish ( ) ; // activities = 0
321
+
322
+ expect ( mockFinish ) . toHaveBeenCalledTimes ( 0 ) ;
323
+ jest . advanceTimersByTime ( interval * 3 ) ;
324
+ expect ( mockFinish ) . toHaveBeenCalledTimes ( 1 ) ;
325
+ } ) ;
326
+ } ) ;
310
327
} ) ;
311
328
312
329
// Integration tests for the default routing instrumentation
You can’t perform that action at this time.
0 commit comments