@@ -114,6 +114,7 @@ describe('instrumentVueRouter()', () => {
114
114
115
115
const from = testRoutes [ fromKey ] ! ;
116
116
const to = testRoutes [ toKey ] ! ;
117
+ beforeEachCallback ( to , testRoutes [ 'initialPageloadRoute' ] ! , mockNext ) ; // fake initial pageload
117
118
beforeEachCallback ( to , from , mockNext ) ;
118
119
119
120
expect ( mockStartSpan ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -127,7 +128,7 @@ describe('instrumentVueRouter()', () => {
127
128
op : 'navigation' ,
128
129
} ) ;
129
130
130
- expect ( mockNext ) . toHaveBeenCalledTimes ( 1 ) ;
131
+ expect ( mockNext ) . toHaveBeenCalledTimes ( 2 ) ;
131
132
} ,
132
133
) ;
133
134
@@ -192,6 +193,7 @@ describe('instrumentVueRouter()', () => {
192
193
193
194
const from = testRoutes . normalRoute1 ! ;
194
195
const to = testRoutes . namedRoute ! ;
196
+ beforeEachCallback ( to , testRoutes [ 'initialPageloadRoute' ] ! , mockNext ) ; // fake initial pageload
195
197
beforeEachCallback ( to , from , mockNext ) ;
196
198
197
199
// first startTx call happens when the instrumentation is initialized (for pageloads)
@@ -219,6 +221,7 @@ describe('instrumentVueRouter()', () => {
219
221
220
222
const from = testRoutes . normalRoute1 ! ;
221
223
const to = testRoutes . namedRoute ! ;
224
+ beforeEachCallback ( to , testRoutes [ 'initialPageloadRoute' ] ! , mockNext ) ; // fake initial pageload
222
225
beforeEachCallback ( to , from , mockNext ) ;
223
226
224
227
// first startTx call happens when the instrumentation is initialized (for pageloads)
@@ -373,6 +376,7 @@ describe('instrumentVueRouter()', () => {
373
376
expect ( mockVueRouter . beforeEach ) . toHaveBeenCalledTimes ( 1 ) ;
374
377
375
378
const beforeEachCallback = mockVueRouter . beforeEach . mock . calls [ 0 ] ! [ 0 ] ! ;
379
+ beforeEachCallback ( testRoutes [ 'normalRoute1' ] ! , testRoutes [ 'initialPageloadRoute' ] ! , mockNext ) ; // fake initial pageload
376
380
beforeEachCallback ( testRoutes [ 'normalRoute2' ] ! , testRoutes [ 'normalRoute1' ] ! , mockNext ) ;
377
381
378
382
expect ( mockStartSpan ) . toHaveBeenCalledTimes ( expectedCallsAmount ) ;
@@ -391,6 +395,7 @@ describe('instrumentVueRouter()', () => {
391
395
392
396
const from = testRoutes . normalRoute1 ! ;
393
397
const to = testRoutes . namedRoute ! ;
398
+ beforeEachCallback ( to , testRoutes [ 'initialPageloadRoute' ] ! , mockNext ) ; // fake initial pageload
394
399
beforeEachCallback ( to , from , undefined ) ;
395
400
396
401
// first startTx call happens when the instrumentation is initialized (for pageloads)
0 commit comments