@@ -2,7 +2,7 @@ import { BrowserClient } from '@sentry/browser';
22import { Hub , makeMain } from '@sentry/hub' ;
33
44import { Span , Transaction } from '../../src' ;
5- import { fetchCallback , FetchData , registerRequestInstrumentation } from '../../src/browser/request' ;
5+ import { _fetchCallback , FetchData , registerRequestInstrumentation } from '../../src/browser/request' ;
66import { addExtensionMethods } from '../../src/hubextensions' ;
77
88declare global {
@@ -69,21 +69,17 @@ describe('registerRequestInstrumentation', () => {
6969 } ) ;
7070} ) ;
7171
72- describe ( 'fetchCallback ' , ( ) => {
72+ describe ( '_fetchCallback() ' , ( ) => {
7373 let hub : Hub ;
7474 let transaction : Transaction ;
75- beforeEach ( ( ) => {
75+ beforeAll ( ( ) => {
7676 hub = new Hub ( new BrowserClient ( { tracesSampleRate : 1 } ) ) ;
7777 makeMain ( hub ) ;
78- transaction = hub . startTransaction ( { name : 'organizations/users/:userid' , op : 'pageload' } ) as Transaction ;
79- hub . configureScope ( scope => scope . setSpan ( transaction ) ) ;
8078 } ) ;
8179
82- afterEach ( ( ) => {
83- if ( transaction ) {
84- transaction . finish ( ) ;
85- }
86- hub . configureScope ( scope => scope . setSpan ( undefined ) ) ;
80+ beforeEach ( ( ) => {
81+ transaction = hub . startTransaction ( { name : 'organizations/users/:userid' , op : 'pageload' } ) as Transaction ;
82+ hub . configureScope ( scope => scope . setSpan ( transaction ) ) ;
8783 } ) ;
8884
8985 it ( 'does not create span if it should not be created' , ( ) => {
@@ -98,7 +94,7 @@ describe('fetchCallback', () => {
9894 } ;
9995 const spans = { } ;
10096
101- fetchCallback ( data , shouldCreateSpan , spans ) ;
97+ _fetchCallback ( data , shouldCreateSpan , spans ) ;
10298 expect ( spans ) . toEqual ( { } ) ;
10399 } ) ;
104100
@@ -110,7 +106,7 @@ describe('fetchCallback', () => {
110106 } ;
111107 const spans = { } ;
112108
113- fetchCallback ( data , shouldCreateSpan , spans ) ;
109+ _fetchCallback ( data , shouldCreateSpan , spans ) ;
114110 expect ( spans ) . toEqual ( { } ) ;
115111 } ) ;
116112
@@ -127,7 +123,7 @@ describe('fetchCallback', () => {
127123 const spans : Record < string , Span > = { } ;
128124
129125 // Start fetch request
130- fetchCallback ( data , shouldCreateSpan , spans ) ;
126+ _fetchCallback ( data , shouldCreateSpan , spans ) ;
131127 const spanKey = Object . keys ( spans ) [ 0 ] ;
132128
133129 const fetchSpan = spans [ spanKey ] ;
@@ -151,7 +147,7 @@ describe('fetchCallback', () => {
151147 } ;
152148
153149 // End fetch request
154- fetchCallback ( newData , shouldCreateSpan , spans ) ;
150+ _fetchCallback ( newData , shouldCreateSpan , spans ) ;
155151 expect ( spans ) . toEqual ( { } ) ;
156152 if ( transaction . spanRecorder ) {
157153 expect ( transaction . spanRecorder . spans [ 1 ] . endTimestamp ) . toBeDefined ( ) ;
0 commit comments