|
1 |
| -import { Event, EventHint } from '@sentry/types'; |
| 1 | +import { Event, EventHint, Severity } 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('critical'); |
89 |
| - expect((scope as any)._level).toEqual('critical'); |
| 88 | + scope.setLevel(Severity.Critical); |
| 89 | + expect((scope as any)._level).toEqual(Severity.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('critical').setUser({ id: '1' }); |
141 |
| - expect((scope as any)._level).toEqual('critical'); |
| 140 | + scope.setLevel(Severity.Critical).setUser({ id: '1' }); |
| 141 | + expect((scope as any)._level).toEqual(Severity.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('warning'); |
| 205 | + scope.setLevel(Severity.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('warning'); |
| 297 | + scope.setLevel(Severity.Warning); |
298 | 298 | const event: Event = {};
|
299 |
| - event.level = 'critical'; |
| 299 | + event.level = Severity.Critical; |
300 | 300 | return scope.applyToEvent(event).then(processedEvent => {
|
301 |
| - expect(processedEvent!.level).toEqual('warning'); |
| 301 | + expect(processedEvent!.level).toEqual(Severity.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('info'); |
| 413 | + scope.setLevel(Severity.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('warning'); |
| 461 | + localScope.setLevel(Severity.Warning); |
462 | 462 | localScope.setFingerprint(['bar']);
|
463 | 463 | (localScope as any)._requestSession = { status: 'ok' };
|
464 | 464 |
|
|
0 commit comments