File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/browser/test/unit Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 11import { getReportDialogEndpoint , SDK_VERSION } from '@sentry/core' ;
2+ import * as utils from '@sentry/utils' ;
23
34import type { Event } from '../../src' ;
45import {
@@ -277,7 +278,7 @@ describe('SentryBrowser initialization', () => {
277278 expect ( sdkData ?. version ) . toBe ( SDK_VERSION ) ;
278279 } ) ;
279280
280- it ( 'uses SDK source from window' , ( ) => {
281+ it ( 'uses SDK source from window for package name ' , ( ) => {
281282 global . SENTRY_SDK_SOURCE = 'loader' ;
282283 init ( { dsn } ) ;
283284
@@ -287,6 +288,17 @@ describe('SentryBrowser initialization', () => {
287288 delete global . SENTRY_SDK_SOURCE ;
288289 } ) ;
289290
291+ it ( 'uses SDK source from global for package name' , ( ) => {
292+ const spy = jest . spyOn ( utils , 'getSDKSource' ) . mockReturnValue ( 'cdn' ) ;
293+ init ( { dsn } ) ;
294+
295+ const sdkData = ( getCurrentHub ( ) . getClient ( ) as any ) . getOptions ( ) . _metadata . sdk ;
296+
297+ expect ( sdkData ?. packages [ 0 ] . name ) . toBe ( 'cdn:@sentry/browser' ) ;
298+ expect ( utils . getSDKSource ) . toBeCalledTimes ( 1 ) ;
299+ spy . mockRestore ( ) ;
300+ } ) ;
301+
290302 it ( 'should set SDK data when instantiating a client directly' , ( ) => {
291303 const options = getDefaultBrowserClientOptions ( { dsn } ) ;
292304 const client = new BrowserClient ( options ) ;
You can’t perform that action at this time.
0 commit comments