|  | 
| 1 |  | -import { Event, EventHint, Severity } 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'; | 
| @@ -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', () => { | 
| @@ -137,8 +137,8 @@ describe('Scope', () => { | 
| 137 | 137 | 
 | 
| 138 | 138 |     test('chaining', () => { | 
| 139 | 139 |       const scope = new Scope(); | 
| 140 |  | -      scope.setLevel(Severity.Critical).setUser({ id: '1' }); | 
| 141 |  | -      expect((scope as any)._level).toEqual(Severity.Critical); | 
|  | 140 | +      scope.setLevel('critical').setUser({ id: '1' }); | 
|  | 141 | +      expect((scope as any)._level).toEqual('critical'); | 
| 142 | 142 |       expect((scope as any)._user).toEqual({ id: '1' }); | 
| 143 | 143 |     }); | 
| 144 | 144 |   }); | 
| @@ -202,7 +202,7 @@ describe('Scope', () => { | 
| 202 | 202 |       scope.setTag('a', 'b'); | 
| 203 | 203 |       scope.setUser({ id: '1' }); | 
| 204 | 204 |       scope.setFingerprint(['abcd']); | 
| 205 |  | -      scope.setLevel(Severity.Warning); | 
|  | 205 | +      scope.setLevel('warning'); | 
| 206 | 206 |       scope.setTransactionName('/abc'); | 
| 207 | 207 |       scope.addBreadcrumb({ message: 'test' }); | 
| 208 | 208 |       scope.setContext('os', { id: '1' }); | 
| @@ -294,11 +294,11 @@ describe('Scope', () => { | 
| 294 | 294 |     test('scope level should have priority over event level', () => { | 
| 295 | 295 |       expect.assertions(1); | 
| 296 | 296 |       const scope = new Scope(); | 
| 297 |  | -      scope.setLevel(Severity.Warning); | 
|  | 297 | +      scope.setLevel('warning'); | 
| 298 | 298 |       const event: Event = {}; | 
| 299 |  | -      event.level = Severity.Critical; | 
|  | 299 | +      event.level = 'critical'; | 
| 300 | 300 |       return scope.applyToEvent(event).then(processedEvent => { | 
| 301 |  | -        expect(processedEvent!.level).toEqual(Severity.Warning); | 
|  | 301 | +        expect(processedEvent!.level).toEqual('warning'); | 
| 302 | 302 |       }); | 
| 303 | 303 |     }); | 
| 304 | 304 | 
 | 
| @@ -410,7 +410,7 @@ describe('Scope', () => { | 
| 410 | 410 |       scope.setContext('foo', { id: '1' }); | 
| 411 | 411 |       scope.setContext('bar', { id: '2' }); | 
| 412 | 412 |       scope.setUser({ id: '1337' }); | 
| 413 |  | -      scope.setLevel(Severity.Info); | 
|  | 413 | +      scope.setLevel('info'); | 
| 414 | 414 |       scope.setFingerprint(['foo']); | 
| 415 | 415 |       scope.setRequestSession({ status: 'ok' }); | 
| 416 | 416 |     }); | 
| @@ -458,7 +458,7 @@ describe('Scope', () => { | 
| 458 | 458 |       localScope.setContext('bar', { id: '3' }); | 
| 459 | 459 |       localScope.setContext('baz', { id: '4' }); | 
| 460 | 460 |       localScope.setUser({ id: '42' }); | 
| 461 |  | -      localScope.setLevel(Severity.Warning); | 
|  | 461 | +      localScope.setLevel('warning'); | 
| 462 | 462 |       localScope.setFingerprint(['bar']); | 
| 463 | 463 |       (localScope as any)._requestSession = { status: 'ok' }; | 
| 464 | 464 | 
 | 
|  | 
0 commit comments