1
- import { Event , EventHint , RequestSessionStatus , Severity } from '@sentry/types' ;
1
+ import { Event , EventHint , RequestSessionStatus } from '@sentry/types' ;
2
2
import { getGlobalObject } from '@sentry/utils' ;
3
3
4
4
import { addGlobalEventProcessor , Scope } from '../src' ;
@@ -85,8 +85,8 @@ describe('Scope', () => {
85
85
86
86
test ( 'setLevel' , ( ) => {
87
87
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' ) ;
90
90
} ) ;
91
91
92
92
test ( 'setTransactionName' , ( ) => {
@@ -131,8 +131,8 @@ describe('Scope', () => {
131
131
132
132
test ( 'chaining' , ( ) => {
133
133
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' ) ;
136
136
expect ( ( scope as any ) . _user ) . toEqual ( { id : '1' } ) ;
137
137
} ) ;
138
138
} ) ;
@@ -195,7 +195,7 @@ describe('Scope', () => {
195
195
scope . setTag ( 'a' , 'b' ) ;
196
196
scope . setUser ( { id : '1' } ) ;
197
197
scope . setFingerprint ( [ 'abcd' ] ) ;
198
- scope . setLevel ( Severity . Warning ) ;
198
+ scope . setLevel ( 'warning' ) ;
199
199
scope . setTransactionName ( '/abc' ) ;
200
200
scope . addBreadcrumb ( { message : 'test' } ) ;
201
201
scope . setContext ( 'os' , { id : '1' } ) ;
@@ -284,9 +284,9 @@ describe('Scope', () => {
284
284
test ( 'scope level should have priority over event level' , ( ) => {
285
285
expect . assertions ( 1 ) ;
286
286
const scope = new Scope ( ) ;
287
- scope . setLevel ( Severity . Warning ) ;
287
+ scope . setLevel ( 'warning' ) ;
288
288
const event : Event = { } ;
289
- event . level = Severity . Critical ;
289
+ event . level = 'critical' ;
290
290
return scope . applyToEvent ( event ) . then ( processedEvent => {
291
291
expect ( processedEvent ! . level ) . toEqual ( 'warning' ) ;
292
292
} ) ;
@@ -400,7 +400,7 @@ describe('Scope', () => {
400
400
scope . setContext ( 'foo' , { id : '1' } ) ;
401
401
scope . setContext ( 'bar' , { id : '2' } ) ;
402
402
scope . setUser ( { id : '1337' } ) ;
403
- scope . setLevel ( Severity . Info ) ;
403
+ scope . setLevel ( 'info' ) ;
404
404
scope . setFingerprint ( [ 'foo' ] ) ;
405
405
scope . setRequestSession ( { status : RequestSessionStatus . Ok } ) ;
406
406
} ) ;
@@ -448,7 +448,7 @@ describe('Scope', () => {
448
448
localScope . setContext ( 'bar' , { id : '3' } ) ;
449
449
localScope . setContext ( 'baz' , { id : '4' } ) ;
450
450
localScope . setUser ( { id : '42' } ) ;
451
- localScope . setLevel ( Severity . Warning ) ;
451
+ localScope . setLevel ( 'warning' ) ;
452
452
localScope . setFingerprint ( [ 'bar' ] ) ;
453
453
( localScope as any ) . _requestSession = { status : RequestSessionStatus . Ok } ;
454
454
@@ -470,7 +470,7 @@ describe('Scope', () => {
470
470
foo : { id : '1' } ,
471
471
} ) ;
472
472
expect ( updatedScope . _user ) . toEqual ( { id : '42' } ) ;
473
- expect ( updatedScope . _level ) . toEqual ( Severity . Warning ) ;
473
+ expect ( updatedScope . _level ) . toEqual ( 'warning' ) ;
474
474
expect ( updatedScope . _fingerprint ) . toEqual ( [ 'bar' ] ) ;
475
475
expect ( updatedScope . _requestSession . status ) . toEqual ( RequestSessionStatus . Ok ) ;
476
476
} ) ;
@@ -491,7 +491,7 @@ describe('Scope', () => {
491
491
foo : { id : '1' } ,
492
492
} ) ;
493
493
expect ( updatedScope . _user ) . toEqual ( { id : '1337' } ) ;
494
- expect ( updatedScope . _level ) . toEqual ( Severity . Info ) ;
494
+ expect ( updatedScope . _level ) . toEqual ( 'info' ) ;
495
495
expect ( updatedScope . _fingerprint ) . toEqual ( [ 'foo' ] ) ;
496
496
expect ( updatedScope . _requestSession . status ) . toEqual ( RequestSessionStatus . Ok ) ;
497
497
} ) ;
@@ -501,7 +501,7 @@ describe('Scope', () => {
501
501
contexts : { bar : { id : '3' } , baz : { id : '4' } } ,
502
502
extra : { bar : '3' , baz : '4' } ,
503
503
fingerprint : [ 'bar' ] ,
504
- level : Severity . Warning ,
504
+ level : 'warning' ,
505
505
tags : { bar : '3' , baz : '4' } ,
506
506
user : { id : '42' } ,
507
507
requestSession : { status : RequestSessionStatus . Errored } ,
@@ -524,7 +524,7 @@ describe('Scope', () => {
524
524
foo : { id : '1' } ,
525
525
} ) ;
526
526
expect ( updatedScope . _user ) . toEqual ( { id : '42' } ) ;
527
- expect ( updatedScope . _level ) . toEqual ( Severity . Warning ) ;
527
+ expect ( updatedScope . _level ) . toEqual ( 'warning' ) ;
528
528
expect ( updatedScope . _fingerprint ) . toEqual ( [ 'bar' ] ) ;
529
529
expect ( updatedScope . _requestSession ) . toEqual ( { status : RequestSessionStatus . Errored } ) ;
530
530
} ) ;
0 commit comments