1- import { Event , EventHint , RequestSessionStatus , Severity } from '@sentry/types' ;
1+ import { Event , EventHint , RequestSessionStatus } from '@sentry/types' ;
22import { getGlobalObject } from '@sentry/utils' ;
33
44import { addGlobalEventProcessor , Scope } from '../src' ;
@@ -85,8 +85,8 @@ describe('Scope', () => {
8585
8686 test ( 'setLevel' , ( ) => {
8787 const scope = new Scope ( ) ;
88- scope . setLevel ( Severity . Critical ) ;
89- expect ( ( scope as any ) . _level ) . toEqual ( Severity . Critical ) ;
88+ scope . setLevel ( 'critical' ) ;
89+ expect ( ( scope as any ) . _level ) . toEqual ( 'critical' ) ;
9090 } ) ;
9191
9292 test ( 'setTransactionName' , ( ) => {
@@ -131,8 +131,8 @@ describe('Scope', () => {
131131
132132 test ( 'chaining' , ( ) => {
133133 const scope = new Scope ( ) ;
134- scope . setLevel ( Severity . Critical ) . setUser ( { id : '1' } ) ;
135- expect ( ( scope as any ) . _level ) . toEqual ( Severity . Critical ) ;
134+ scope . setLevel ( 'critical' ) . setUser ( { id : '1' } ) ;
135+ expect ( ( scope as any ) . _level ) . toEqual ( 'critical' ) ;
136136 expect ( ( scope as any ) . _user ) . toEqual ( { id : '1' } ) ;
137137 } ) ;
138138 } ) ;
@@ -195,7 +195,7 @@ describe('Scope', () => {
195195 scope . setTag ( 'a' , 'b' ) ;
196196 scope . setUser ( { id : '1' } ) ;
197197 scope . setFingerprint ( [ 'abcd' ] ) ;
198- scope . setLevel ( Severity . Warning ) ;
198+ scope . setLevel ( 'warning' ) ;
199199 scope . setTransactionName ( '/abc' ) ;
200200 scope . addBreadcrumb ( { message : 'test' } ) ;
201201 scope . setContext ( 'os' , { id : '1' } ) ;
@@ -284,9 +284,9 @@ describe('Scope', () => {
284284 test ( 'scope level should have priority over event level' , ( ) => {
285285 expect . assertions ( 1 ) ;
286286 const scope = new Scope ( ) ;
287- scope . setLevel ( Severity . Warning ) ;
287+ scope . setLevel ( 'warning' ) ;
288288 const event : Event = { } ;
289- event . level = Severity . Critical ;
289+ event . level = 'critical' ;
290290 return scope . applyToEvent ( event ) . then ( processedEvent => {
291291 expect ( processedEvent ! . level ) . toEqual ( 'warning' ) ;
292292 } ) ;
@@ -400,7 +400,7 @@ describe('Scope', () => {
400400 scope . setContext ( 'foo' , { id : '1' } ) ;
401401 scope . setContext ( 'bar' , { id : '2' } ) ;
402402 scope . setUser ( { id : '1337' } ) ;
403- scope . setLevel ( Severity . Info ) ;
403+ scope . setLevel ( 'info' ) ;
404404 scope . setFingerprint ( [ 'foo' ] ) ;
405405 scope . setRequestSession ( { status : RequestSessionStatus . Ok } ) ;
406406 } ) ;
@@ -448,7 +448,7 @@ describe('Scope', () => {
448448 localScope . setContext ( 'bar' , { id : '3' } ) ;
449449 localScope . setContext ( 'baz' , { id : '4' } ) ;
450450 localScope . setUser ( { id : '42' } ) ;
451- localScope . setLevel ( Severity . Warning ) ;
451+ localScope . setLevel ( 'warning' ) ;
452452 localScope . setFingerprint ( [ 'bar' ] ) ;
453453 ( localScope as any ) . _requestSession = { status : RequestSessionStatus . Ok } ;
454454
@@ -470,7 +470,7 @@ describe('Scope', () => {
470470 foo : { id : '1' } ,
471471 } ) ;
472472 expect ( updatedScope . _user ) . toEqual ( { id : '42' } ) ;
473- expect ( updatedScope . _level ) . toEqual ( Severity . Warning ) ;
473+ expect ( updatedScope . _level ) . toEqual ( 'warning' ) ;
474474 expect ( updatedScope . _fingerprint ) . toEqual ( [ 'bar' ] ) ;
475475 expect ( updatedScope . _requestSession . status ) . toEqual ( RequestSessionStatus . Ok ) ;
476476 } ) ;
@@ -491,7 +491,7 @@ describe('Scope', () => {
491491 foo : { id : '1' } ,
492492 } ) ;
493493 expect ( updatedScope . _user ) . toEqual ( { id : '1337' } ) ;
494- expect ( updatedScope . _level ) . toEqual ( Severity . Info ) ;
494+ expect ( updatedScope . _level ) . toEqual ( 'info' ) ;
495495 expect ( updatedScope . _fingerprint ) . toEqual ( [ 'foo' ] ) ;
496496 expect ( updatedScope . _requestSession . status ) . toEqual ( RequestSessionStatus . Ok ) ;
497497 } ) ;
@@ -501,7 +501,7 @@ describe('Scope', () => {
501501 contexts : { bar : { id : '3' } , baz : { id : '4' } } ,
502502 extra : { bar : '3' , baz : '4' } ,
503503 fingerprint : [ 'bar' ] ,
504- level : Severity . Warning ,
504+ level : 'warning' ,
505505 tags : { bar : '3' , baz : '4' } ,
506506 user : { id : '42' } ,
507507 requestSession : { status : RequestSessionStatus . Errored } ,
@@ -524,7 +524,7 @@ describe('Scope', () => {
524524 foo : { id : '1' } ,
525525 } ) ;
526526 expect ( updatedScope . _user ) . toEqual ( { id : '42' } ) ;
527- expect ( updatedScope . _level ) . toEqual ( Severity . Warning ) ;
527+ expect ( updatedScope . _level ) . toEqual ( 'warning' ) ;
528528 expect ( updatedScope . _fingerprint ) . toEqual ( [ 'bar' ] ) ;
529529 expect ( updatedScope . _requestSession ) . toEqual ( { status : RequestSessionStatus . Errored } ) ;
530530 } ) ;
0 commit comments