1
- import { Outcome } from '@sentry/types' ;
2
1
import { SentryError } from '@sentry/utils' ;
3
2
4
- import { Event , Response , Status , Transports } from '../../../src' ;
3
+ import { Event , Response , Transports } from '../../../src' ;
5
4
6
5
const testDsn = 'https://[email protected] /42' ;
7
6
const storeUrl = 'https://sentry.io/api/42/store/?sentry_key=123&sentry_version=7' ;
@@ -61,7 +60,7 @@ describe('FetchTransport', () => {
61
60
62
61
const res = await transport . sendEvent ( eventPayload ) ;
63
62
64
- expect ( ( res as Response ) . status ) . toBe ( Status . Success ) ;
63
+ expect ( ( res as Response ) . status ) . toBe ( 'success' ) ;
65
64
expect ( fetch ) . toHaveBeenCalledWith ( storeUrl , {
66
65
body : JSON . stringify ( eventPayload ) ,
67
66
method : 'POST' ,
@@ -117,7 +116,7 @@ describe('FetchTransport', () => {
117
116
try {
118
117
await transport . sendEvent ( eventPayload ) ;
119
118
} catch ( _ ) {
120
- expect ( spy ) . toHaveBeenCalledWith ( Outcome . NetworkError , 'event' ) ;
119
+ expect ( spy ) . toHaveBeenCalledWith ( 'network_error' , 'event' ) ;
121
120
}
122
121
} ) ;
123
122
@@ -129,7 +128,7 @@ describe('FetchTransport', () => {
129
128
try {
130
129
await transport . sendEvent ( transactionPayload ) ;
131
130
} catch ( _ ) {
132
- expect ( spy ) . toHaveBeenCalledWith ( Outcome . QueueOverflow , 'transaction' ) ;
131
+ expect ( spy ) . toHaveBeenCalledWith ( 'queue_overflow' , 'transaction' ) ;
133
132
}
134
133
} ) ;
135
134
@@ -149,7 +148,7 @@ describe('FetchTransport', () => {
149
148
150
149
const res = await transport . sendEvent ( eventPayload ) ;
151
150
152
- expect ( ( res as Response ) . status ) . toBe ( Status . Success ) ;
151
+ expect ( ( res as Response ) . status ) . toBe ( 'success' ) ;
153
152
expect ( fetch ) . toHaveBeenCalledWith ( storeUrl , {
154
153
body : JSON . stringify ( eventPayload ) ,
155
154
headers : {
@@ -176,7 +175,7 @@ describe('FetchTransport', () => {
176
175
177
176
const res = await transport . sendEvent ( eventPayload ) ;
178
177
179
- expect ( ( res as Response ) . status ) . toBe ( Status . Success ) ;
178
+ expect ( ( res as Response ) . status ) . toBe ( 'success' ) ;
180
179
expect ( fetch ) . toHaveBeenCalledWith ( storeUrl , {
181
180
body : JSON . stringify ( eventPayload ) ,
182
181
credentials : 'include' ,
@@ -232,7 +231,7 @@ describe('FetchTransport', () => {
232
231
window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
233
232
234
233
const eventRes = await transport . sendEvent ( eventPayload ) ;
235
- expect ( eventRes . status ) . toBe ( Status . Success ) ;
234
+ expect ( eventRes . status ) . toBe ( 'success' ) ;
236
235
expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
237
236
} ) ;
238
237
@@ -275,7 +274,7 @@ describe('FetchTransport', () => {
275
274
window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
276
275
277
276
const transactionRes = await transport . sendEvent ( transactionPayload ) ;
278
- expect ( transactionRes . status ) . toBe ( Status . Success ) ;
277
+ expect ( transactionRes . status ) . toBe ( 'success' ) ;
279
278
expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
280
279
281
280
try {
@@ -290,7 +289,7 @@ describe('FetchTransport', () => {
290
289
}
291
290
292
291
const eventRes = await transport . sendEvent ( eventPayload ) ;
293
- expect ( eventRes . status ) . toBe ( Status . Success ) ;
292
+ expect ( eventRes . status ) . toBe ( 'success' ) ;
294
293
expect ( fetch ) . toHaveBeenCalledTimes ( 3 ) ;
295
294
} ) ;
296
295
@@ -357,11 +356,11 @@ describe('FetchTransport', () => {
357
356
window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
358
357
359
358
const eventRes = await transport . sendEvent ( eventPayload ) ;
360
- expect ( eventRes . status ) . toBe ( Status . Success ) ;
359
+ expect ( eventRes . status ) . toBe ( 'success' ) ;
361
360
expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
362
361
363
362
const transactionRes = await transport . sendEvent ( transactionPayload ) ;
364
- expect ( transactionRes . status ) . toBe ( Status . Success ) ;
363
+ expect ( transactionRes . status ) . toBe ( 'success' ) ;
365
364
expect ( fetch ) . toHaveBeenCalledTimes ( 3 ) ;
366
365
} ) ;
367
366
@@ -428,11 +427,11 @@ describe('FetchTransport', () => {
428
427
window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
429
428
430
429
const eventRes = await transport . sendEvent ( eventPayload ) ;
431
- expect ( eventRes . status ) . toBe ( Status . Success ) ;
430
+ expect ( eventRes . status ) . toBe ( 'success' ) ;
432
431
expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
433
432
434
433
const transactionRes = await transport . sendEvent ( transactionPayload ) ;
435
- expect ( transactionRes . status ) . toBe ( Status . Success ) ;
434
+ expect ( transactionRes . status ) . toBe ( 'success' ) ;
436
435
expect ( fetch ) . toHaveBeenCalledTimes ( 3 ) ;
437
436
} ) ;
438
437
@@ -460,7 +459,7 @@ describe('FetchTransport', () => {
460
459
window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers } ) ) ;
461
460
462
461
let eventRes = await transport . sendEvent ( eventPayload ) ;
463
- expect ( eventRes . status ) . toBe ( Status . Success ) ;
462
+ expect ( eventRes . status ) . toBe ( 'success' ) ;
464
463
expect ( fetch ) . toHaveBeenCalled ( ) ;
465
464
466
465
try {
@@ -477,7 +476,7 @@ describe('FetchTransport', () => {
477
476
window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
478
477
479
478
eventRes = await transport . sendEvent ( eventPayload ) ;
480
- expect ( eventRes . status ) . toBe ( Status . Success ) ;
479
+ expect ( eventRes . status ) . toBe ( 'success' ) ;
481
480
expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
482
481
} ) ;
483
482
@@ -490,13 +489,13 @@ describe('FetchTransport', () => {
490
489
try {
491
490
await transport . sendEvent ( eventPayload ) ;
492
491
} catch ( _ ) {
493
- expect ( spy ) . toHaveBeenCalledWith ( Outcome . RateLimitBackoff , 'event' ) ;
492
+ expect ( spy ) . toHaveBeenCalledWith ( 'ratelimit_backoff' , 'event' ) ;
494
493
}
495
494
496
495
try {
497
496
await transport . sendEvent ( transactionPayload ) ;
498
497
} catch ( _ ) {
499
- expect ( spy ) . toHaveBeenCalledWith ( Outcome . RateLimitBackoff , 'transaction' ) ;
498
+ expect ( spy ) . toHaveBeenCalledWith ( 'ratelimit_backoff' , 'transaction' ) ;
500
499
}
501
500
} ) ;
502
501
} ) ;
0 commit comments