11import type { BrowserClient } from '@sentry/browser' ;
22import * as SentryBrowser from '@sentry/browser' ;
3- import { BrowserTracing , getCurrentHub , SDK_VERSION , WINDOW } from '@sentry/browser' ;
3+ import { BrowserTracing , getClient , getCurrentHub , SDK_VERSION , WINDOW } from '@sentry/browser' ;
44import { vi } from 'vitest' ;
55
66import { init } from '../../../astro/src/client/sdk' ;
@@ -60,7 +60,7 @@ describe('Sentry client SDK', () => {
6060 } ) ;
6161
6262 const integrationsToInit = browserInit . mock . calls [ 0 ] [ 0 ] ?. integrations ;
63- const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
63+ const browserTracing = getClient < BrowserClient > ( ) ?. getIntegrationById ( 'BrowserTracing' ) ;
6464
6565 expect ( integrationsToInit ) . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
6666 expect ( browserTracing ) . toBeDefined ( ) ;
@@ -76,7 +76,7 @@ describe('Sentry client SDK', () => {
7676 } ) ;
7777
7878 const integrationsToInit = browserInit . mock . calls [ 0 ] [ 0 ] ?. integrations ;
79- const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
79+ const browserTracing = getClient < BrowserClient > ( ) ?. getIntegrationById ( 'BrowserTracing' ) ;
8080
8181 expect ( integrationsToInit ) . not . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
8282 expect ( browserTracing ) . toBeUndefined ( ) ;
@@ -91,7 +91,7 @@ describe('Sentry client SDK', () => {
9191 } ) ;
9292
9393 const integrationsToInit = browserInit . mock . calls [ 0 ] [ 0 ] ?. integrations ;
94- const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById ( 'BrowserTracing' ) ;
94+ const browserTracing = getClient < BrowserClient > ( ) ?. getIntegrationById ( 'BrowserTracing' ) ;
9595
9696 expect ( integrationsToInit ) . not . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
9797 expect ( browserTracing ) . toBeUndefined ( ) ;
@@ -108,9 +108,7 @@ describe('Sentry client SDK', () => {
108108
109109 const integrationsToInit = browserInit . mock . calls [ 0 ] [ 0 ] ?. integrations ;
110110
111- const browserTracing = ( getCurrentHub ( ) . getClient ( ) as BrowserClient ) ?. getIntegrationById (
112- 'BrowserTracing' ,
113- ) as BrowserTracing ;
111+ const browserTracing = getClient < BrowserClient > ( ) ?. getIntegrationById ( 'BrowserTracing' ) as BrowserTracing ;
114112 const options = browserTracing . options ;
115113
116114 expect ( integrationsToInit ) . toContainEqual ( expect . objectContaining ( { name : 'BrowserTracing' } ) ) ;
0 commit comments