1
- import { Event , EventHint , RequestSessionStatus } from '@sentry/types' ;
1
+ import { Event , EventHint } from '@sentry/types' ;
2
2
import { getGlobalObject } from '@sentry/utils' ;
3
3
4
4
import { addGlobalEventProcessor , Scope } from '../src' ;
@@ -147,7 +147,7 @@ describe('Scope', () => {
147
147
148
148
test ( '_requestSession clone' , ( ) => {
149
149
const parentScope = new Scope ( ) ;
150
- parentScope . setRequestSession ( { status : RequestSessionStatus . Errored } ) ;
150
+ parentScope . setRequestSession ( { status : 'errored' } ) ;
151
151
const scope = Scope . clone ( parentScope ) ;
152
152
expect ( parentScope . getRequestSession ( ) ) . toEqual ( scope . getRequestSession ( ) ) ;
153
153
} ) ;
@@ -174,16 +174,16 @@ describe('Scope', () => {
174
174
// Test that ensures if the status value of `status` of `_requestSession` is changed in a child scope
175
175
// that it should also change in parent scope because we are copying the reference to the object
176
176
const parentScope = new Scope ( ) ;
177
- parentScope . setRequestSession ( { status : RequestSessionStatus . Errored } ) ;
177
+ parentScope . setRequestSession ( { status : 'errored' } ) ;
178
178
179
179
const scope = Scope . clone ( parentScope ) ;
180
180
const requestSession = scope . getRequestSession ( ) ;
181
181
if ( requestSession ) {
182
- requestSession . status = RequestSessionStatus . Ok ;
182
+ requestSession . status = 'ok' ;
183
183
}
184
184
185
- expect ( parentScope . getRequestSession ( ) ) . toEqual ( { status : RequestSessionStatus . Ok } ) ;
186
- expect ( scope . getRequestSession ( ) ) . toEqual ( { status : RequestSessionStatus . Ok } ) ;
185
+ expect ( parentScope . getRequestSession ( ) ) . toEqual ( { status : 'ok' } ) ;
186
+ expect ( scope . getRequestSession ( ) ) . toEqual ( { status : 'ok' } ) ;
187
187
} ) ;
188
188
} ) ;
189
189
@@ -375,7 +375,7 @@ describe('Scope', () => {
375
375
scope . setUser ( { id : '1' } ) ;
376
376
scope . setFingerprint ( [ 'abcd' ] ) ;
377
377
scope . addBreadcrumb ( { message : 'test' } ) ;
378
- scope . setRequestSession ( { status : RequestSessionStatus . Ok } ) ;
378
+ scope . setRequestSession ( { status : 'ok' } ) ;
379
379
expect ( ( scope as any ) . _extra ) . toEqual ( { a : 2 } ) ;
380
380
scope . clear ( ) ;
381
381
expect ( ( scope as any ) . _extra ) . toEqual ( { } ) ;
@@ -402,7 +402,7 @@ describe('Scope', () => {
402
402
scope . setUser ( { id : '1337' } ) ;
403
403
scope . setLevel ( 'info' ) ;
404
404
scope . setFingerprint ( [ 'foo' ] ) ;
405
- scope . setRequestSession ( { status : RequestSessionStatus . Ok } ) ;
405
+ scope . setRequestSession ( { status : 'ok' } ) ;
406
406
} ) ;
407
407
408
408
test ( 'given no data, returns the original scope' , ( ) => {
@@ -450,7 +450,7 @@ describe('Scope', () => {
450
450
localScope . setUser ( { id : '42' } ) ;
451
451
localScope . setLevel ( 'warning' ) ;
452
452
localScope . setFingerprint ( [ 'bar' ] ) ;
453
- ( localScope as any ) . _requestSession = { status : RequestSessionStatus . Ok } ;
453
+ ( localScope as any ) . _requestSession = { status : 'ok' } ;
454
454
455
455
const updatedScope = scope . update ( localScope ) as any ;
456
456
@@ -472,7 +472,7 @@ describe('Scope', () => {
472
472
expect ( updatedScope . _user ) . toEqual ( { id : '42' } ) ;
473
473
expect ( updatedScope . _level ) . toEqual ( 'warning' ) ;
474
474
expect ( updatedScope . _fingerprint ) . toEqual ( [ 'bar' ] ) ;
475
- expect ( updatedScope . _requestSession . status ) . toEqual ( RequestSessionStatus . Ok ) ;
475
+ expect ( updatedScope . _requestSession . status ) . toEqual ( 'ok' ) ;
476
476
} ) ;
477
477
478
478
test ( 'given an empty instance of Scope, it should preserve all the original scope data' , ( ) => {
@@ -493,7 +493,7 @@ describe('Scope', () => {
493
493
expect ( updatedScope . _user ) . toEqual ( { id : '1337' } ) ;
494
494
expect ( updatedScope . _level ) . toEqual ( 'info' ) ;
495
495
expect ( updatedScope . _fingerprint ) . toEqual ( [ 'foo' ] ) ;
496
- expect ( updatedScope . _requestSession . status ) . toEqual ( RequestSessionStatus . Ok ) ;
496
+ expect ( updatedScope . _requestSession . status ) . toEqual ( 'ok' ) ;
497
497
} ) ;
498
498
499
499
test ( 'given a plain object, it should merge two together, with the passed object having priority' , ( ) => {
@@ -504,7 +504,7 @@ describe('Scope', () => {
504
504
level : 'warning' ,
505
505
tags : { bar : '3' , baz : '4' } ,
506
506
user : { id : '42' } ,
507
- requestSession : { status : RequestSessionStatus . Errored } ,
507
+ requestSession : { status : 'errored' } ,
508
508
} ;
509
509
const updatedScope = scope . update ( localAttributes ) as any ;
510
510
@@ -526,7 +526,7 @@ describe('Scope', () => {
526
526
expect ( updatedScope . _user ) . toEqual ( { id : '42' } ) ;
527
527
expect ( updatedScope . _level ) . toEqual ( 'warning' ) ;
528
528
expect ( updatedScope . _fingerprint ) . toEqual ( [ 'bar' ] ) ;
529
- expect ( updatedScope . _requestSession ) . toEqual ( { status : RequestSessionStatus . Errored } ) ;
529
+ expect ( updatedScope . _requestSession ) . toEqual ( { status : 'errored' } ) ;
530
530
} ) ;
531
531
} ) ;
532
532
0 commit comments