1- import { Outcome } from '@sentry/types' ;
21import { SentryError } from '@sentry/utils' ;
32
4- import { Event , Response , Status , Transports } from '../../../src' ;
3+ import { Event , Response , Transports } from '../../../src' ;
54
65const testDsn = 'https://[email protected] /42' ; 76const storeUrl = 'https://sentry.io/api/42/store/?sentry_key=123&sentry_version=7' ;
@@ -61,7 +60,7 @@ describe('FetchTransport', () => {
6160
6261 const res = await transport . sendEvent ( eventPayload ) ;
6362
64- expect ( ( res as Response ) . status ) . toBe ( Status . Success ) ;
63+ expect ( ( res as Response ) . status ) . toBe ( 'success' ) ;
6564 expect ( fetch ) . toHaveBeenCalledWith ( storeUrl , {
6665 body : JSON . stringify ( eventPayload ) ,
6766 method : 'POST' ,
@@ -117,7 +116,7 @@ describe('FetchTransport', () => {
117116 try {
118117 await transport . sendEvent ( eventPayload ) ;
119118 } catch ( _ ) {
120- expect ( spy ) . toHaveBeenCalledWith ( Outcome . NetworkError , 'event' ) ;
119+ expect ( spy ) . toHaveBeenCalledWith ( 'network_error' , 'event' ) ;
121120 }
122121 } ) ;
123122
@@ -129,7 +128,7 @@ describe('FetchTransport', () => {
129128 try {
130129 await transport . sendEvent ( transactionPayload ) ;
131130 } catch ( _ ) {
132- expect ( spy ) . toHaveBeenCalledWith ( Outcome . QueueOverflow , 'transaction' ) ;
131+ expect ( spy ) . toHaveBeenCalledWith ( 'queue_overflow' , 'transaction' ) ;
133132 }
134133 } ) ;
135134
@@ -149,7 +148,7 @@ describe('FetchTransport', () => {
149148
150149 const res = await transport . sendEvent ( eventPayload ) ;
151150
152- expect ( ( res as Response ) . status ) . toBe ( Status . Success ) ;
151+ expect ( ( res as Response ) . status ) . toBe ( 'success' ) ;
153152 expect ( fetch ) . toHaveBeenCalledWith ( storeUrl , {
154153 body : JSON . stringify ( eventPayload ) ,
155154 headers : {
@@ -176,7 +175,7 @@ describe('FetchTransport', () => {
176175
177176 const res = await transport . sendEvent ( eventPayload ) ;
178177
179- expect ( ( res as Response ) . status ) . toBe ( Status . Success ) ;
178+ expect ( ( res as Response ) . status ) . toBe ( 'success' ) ;
180179 expect ( fetch ) . toHaveBeenCalledWith ( storeUrl , {
181180 body : JSON . stringify ( eventPayload ) ,
182181 credentials : 'include' ,
@@ -232,7 +231,7 @@ describe('FetchTransport', () => {
232231 window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
233232
234233 const eventRes = await transport . sendEvent ( eventPayload ) ;
235- expect ( eventRes . status ) . toBe ( Status . Success ) ;
234+ expect ( eventRes . status ) . toBe ( 'success' ) ;
236235 expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
237236 } ) ;
238237
@@ -275,7 +274,7 @@ describe('FetchTransport', () => {
275274 window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
276275
277276 const transactionRes = await transport . sendEvent ( transactionPayload ) ;
278- expect ( transactionRes . status ) . toBe ( Status . Success ) ;
277+ expect ( transactionRes . status ) . toBe ( 'success' ) ;
279278 expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
280279
281280 try {
@@ -290,7 +289,7 @@ describe('FetchTransport', () => {
290289 }
291290
292291 const eventRes = await transport . sendEvent ( eventPayload ) ;
293- expect ( eventRes . status ) . toBe ( Status . Success ) ;
292+ expect ( eventRes . status ) . toBe ( 'success' ) ;
294293 expect ( fetch ) . toHaveBeenCalledTimes ( 3 ) ;
295294 } ) ;
296295
@@ -357,11 +356,11 @@ describe('FetchTransport', () => {
357356 window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
358357
359358 const eventRes = await transport . sendEvent ( eventPayload ) ;
360- expect ( eventRes . status ) . toBe ( Status . Success ) ;
359+ expect ( eventRes . status ) . toBe ( 'success' ) ;
361360 expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
362361
363362 const transactionRes = await transport . sendEvent ( transactionPayload ) ;
364- expect ( transactionRes . status ) . toBe ( Status . Success ) ;
363+ expect ( transactionRes . status ) . toBe ( 'success' ) ;
365364 expect ( fetch ) . toHaveBeenCalledTimes ( 3 ) ;
366365 } ) ;
367366
@@ -428,11 +427,11 @@ describe('FetchTransport', () => {
428427 window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
429428
430429 const eventRes = await transport . sendEvent ( eventPayload ) ;
431- expect ( eventRes . status ) . toBe ( Status . Success ) ;
430+ expect ( eventRes . status ) . toBe ( 'success' ) ;
432431 expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
433432
434433 const transactionRes = await transport . sendEvent ( transactionPayload ) ;
435- expect ( transactionRes . status ) . toBe ( Status . Success ) ;
434+ expect ( transactionRes . status ) . toBe ( 'success' ) ;
436435 expect ( fetch ) . toHaveBeenCalledTimes ( 3 ) ;
437436 } ) ;
438437
@@ -460,7 +459,7 @@ describe('FetchTransport', () => {
460459 window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers } ) ) ;
461460
462461 let eventRes = await transport . sendEvent ( eventPayload ) ;
463- expect ( eventRes . status ) . toBe ( Status . Success ) ;
462+ expect ( eventRes . status ) . toBe ( 'success' ) ;
464463 expect ( fetch ) . toHaveBeenCalled ( ) ;
465464
466465 try {
@@ -477,7 +476,7 @@ describe('FetchTransport', () => {
477476 window . fetch . mockImplementation ( ( ) => Promise . resolve ( { status : 200 , headers : new Headers ( ) } ) ) ;
478477
479478 eventRes = await transport . sendEvent ( eventPayload ) ;
480- expect ( eventRes . status ) . toBe ( Status . Success ) ;
479+ expect ( eventRes . status ) . toBe ( 'success' ) ;
481480 expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
482481 } ) ;
483482
@@ -490,13 +489,13 @@ describe('FetchTransport', () => {
490489 try {
491490 await transport . sendEvent ( eventPayload ) ;
492491 } catch ( _ ) {
493- expect ( spy ) . toHaveBeenCalledWith ( Outcome . RateLimitBackoff , 'event' ) ;
492+ expect ( spy ) . toHaveBeenCalledWith ( 'ratelimit_backoff' , 'event' ) ;
494493 }
495494
496495 try {
497496 await transport . sendEvent ( transactionPayload ) ;
498497 } catch ( _ ) {
499- expect ( spy ) . toHaveBeenCalledWith ( Outcome . RateLimitBackoff , 'transaction' ) ;
498+ expect ( spy ) . toHaveBeenCalledWith ( 'ratelimit_backoff' , 'transaction' ) ;
500499 }
501500 } ) ;
502501 } ) ;
0 commit comments