1
- import { Outcome } from '@sentry/types' ;
2
-
3
1
import { BaseTransport } from '../../../src/transports/base' ;
4
2
5
3
const testDsn = 'https://123@sentry.io/42' ;
@@ -44,12 +42,12 @@ describe('BaseTransport', () => {
44
42
it ( 'sends beacon request when there are outcomes captured and visibility changed to `hidden`' , ( ) => {
45
43
const transport = new SimpleTransport ( { dsn : testDsn , sendClientReports : true } ) ;
46
44
47
- transport . recordLostEvent ( Outcome . BeforeSend , 'event' ) ;
45
+ transport . recordLostEvent ( 'before_send' , 'event' ) ;
48
46
49
47
visibilityState = 'hidden' ;
50
48
document . dispatchEvent ( new Event ( 'visibilitychange' ) ) ;
51
49
52
- const outcomes = [ { reason : Outcome . BeforeSend , category : 'error' , quantity : 1 } ] ;
50
+ const outcomes = [ { reason : 'before_send' , category : 'error' , quantity : 1 } ] ;
53
51
54
52
expect ( sendBeaconSpy ) . toHaveBeenCalledWith (
55
53
envelopeEndpoint ,
@@ -59,7 +57,7 @@ describe('BaseTransport', () => {
59
57
60
58
it ( 'doesnt send beacon request when there are outcomes captured, but visibility state did not change to `hidden`' , ( ) => {
61
59
const transport = new SimpleTransport ( { dsn : testDsn , sendClientReports : true } ) ;
62
- transport . recordLostEvent ( Outcome . BeforeSend , 'event' ) ;
60
+ transport . recordLostEvent ( 'before_send' , 'event' ) ;
63
61
64
62
visibilityState = 'visible' ;
65
63
document . dispatchEvent ( new Event ( 'visibilitychange' ) ) ;
@@ -70,21 +68,21 @@ describe('BaseTransport', () => {
70
68
it ( 'correctly serializes request with different categories/reasons pairs' , ( ) => {
71
69
const transport = new SimpleTransport ( { dsn : testDsn , sendClientReports : true } ) ;
72
70
73
- transport . recordLostEvent ( Outcome . BeforeSend , 'event' ) ;
74
- transport . recordLostEvent ( Outcome . BeforeSend , 'event' ) ;
75
- transport . recordLostEvent ( Outcome . SampleRate , 'transaction' ) ;
76
- transport . recordLostEvent ( Outcome . NetworkError , 'session' ) ;
77
- transport . recordLostEvent ( Outcome . NetworkError , 'session' ) ;
78
- transport . recordLostEvent ( Outcome . RateLimitBackoff , 'event' ) ;
71
+ transport . recordLostEvent ( 'before_send' , 'event' ) ;
72
+ transport . recordLostEvent ( 'before_send' , 'event' ) ;
73
+ transport . recordLostEvent ( 'sample_rate' , 'transaction' ) ;
74
+ transport . recordLostEvent ( 'network_error' , 'session' ) ;
75
+ transport . recordLostEvent ( 'network_error' , 'session' ) ;
76
+ transport . recordLostEvent ( 'ratelimit_backoff' , 'event' ) ;
79
77
80
78
visibilityState = 'hidden' ;
81
79
document . dispatchEvent ( new Event ( 'visibilitychange' ) ) ;
82
80
83
81
const outcomes = [
84
- { reason : Outcome . BeforeSend , category : 'error' , quantity : 2 } ,
85
- { reason : Outcome . SampleRate , category : 'transaction' , quantity : 1 } ,
86
- { reason : Outcome . NetworkError , category : 'session' , quantity : 2 } ,
87
- { reason : Outcome . RateLimitBackoff , category : 'error' , quantity : 1 } ,
82
+ { reason : 'before_send' , category : 'error' , quantity : 2 } ,
83
+ { reason : 'sample_rate' , category : 'transaction' , quantity : 1 } ,
84
+ { reason : 'network_error' , category : 'session' , quantity : 2 } ,
85
+ { reason : 'ratelimit_backoff' , category : 'error' , quantity : 1 } ,
88
86
] ;
89
87
90
88
expect ( sendBeaconSpy ) . toHaveBeenCalledWith (
@@ -97,12 +95,12 @@ describe('BaseTransport', () => {
97
95
const tunnel = 'https://hello.com/world' ;
98
96
const transport = new SimpleTransport ( { dsn : testDsn , sendClientReports : true , tunnel } ) ;
99
97
100
- transport . recordLostEvent ( Outcome . BeforeSend , 'event' ) ;
98
+ transport . recordLostEvent ( 'before_send' , 'event' ) ;
101
99
102
100
visibilityState = 'hidden' ;
103
101
document . dispatchEvent ( new Event ( 'visibilitychange' ) ) ;
104
102
105
- const outcomes = [ { reason : Outcome . BeforeSend , category : 'error' , quantity : 1 } ] ;
103
+ const outcomes = [ { reason : 'before_send' , category : 'error' , quantity : 1 } ] ;
106
104
107
105
expect ( sendBeaconSpy ) . toHaveBeenCalledWith (
108
106
tunnel ,
0 commit comments