11import { BrowserClient } from '@sentry/browser' ;
22import { Hub , Scope } from '@sentry/hub' ;
3- import { Span , Transaction } from '@sentry/types' ;
43
54import { addExtensionMethods } from '../src/hubextensions' ;
65
@@ -21,21 +20,18 @@ describe('Hub', () => {
2120 } ) ;
2221 test ( 'set tracesSampleRate 0 on transaction' , ( ) => {
2322 const hub = new Hub ( new BrowserClient ( { tracesSampleRate : 0 } ) ) ;
24- // @ts -ignore
25- const transaction = hub . startSpan ( { name : 'foo' } ) as any ;
23+ const transaction = hub . startTransaction ( { name : 'foo' } ) ;
2624 expect ( transaction . sampled ) . toBe ( false ) ;
2725 } ) ;
2826 test ( 'set tracesSampleRate 1 on transaction' , ( ) => {
2927 const hub = new Hub ( new BrowserClient ( { tracesSampleRate : 1 } ) ) ;
30- // @ts -ignore
31- const transaction = hub . startSpan ( { name : 'foo' } ) as any ;
28+ const transaction = hub . startTransaction ( { name : 'foo' } ) ;
3229 expect ( transaction . sampled ) . toBeTruthy ( ) ;
3330 } ) ;
3431 test ( 'set tracesSampleRate should be propergated to children' , ( ) => {
3532 const hub = new Hub ( new BrowserClient ( { tracesSampleRate : 0 } ) ) ;
36- // @ts -ignore
37- const transaction = hub . startSpan ( { name : 'foo' } ) as any ;
38- const child = transaction . startChild ( { op : 1 } ) ;
33+ const transaction = hub . startTransaction ( { name : 'foo' } ) ;
34+ const child = transaction . startChild ( { op : 'test' } ) ;
3935 expect ( child . sampled ) . toBeFalsy ( ) ;
4036 } ) ;
4137 } ) ;
@@ -49,8 +45,7 @@ describe('Hub', () => {
4945
5046 test ( 'simple standalone Transaction' , ( ) => {
5147 const hub = new Hub ( new BrowserClient ( { tracesSampleRate : 1 } ) ) ;
52- // @ts -ignore
53- const transaction = hub . startSpan ( { name : 'transaction' } ) as Transaction ;
48+ const transaction = hub . startTransaction ( { name : 'transaction' } ) ;
5449 expect ( transaction . spanId ) . toBeTruthy ( ) ;
5550 // tslint:disable-next-line: no-unbound-method
5651 expect ( transaction . setName ) . toBeTruthy ( ) ;
@@ -71,8 +66,7 @@ describe('Hub', () => {
7166 test ( 'create a child if there is a Span already on the scope' , ( ) => {
7267 const myScope = new Scope ( ) ;
7368 const hub = new Hub ( new BrowserClient ( { tracesSampleRate : 1 } ) , myScope ) ;
74- // @ts -ignore
75- const transaction = hub . startSpan ( { name : 'transaction' } ) as Transaction ;
69+ const transaction = hub . startTransaction ( { name : 'transaction' } ) ;
7670 hub . configureScope ( scope => {
7771 scope . setSpan ( transaction ) ;
7872 } ) ;
0 commit comments