@@ -17,8 +17,8 @@ describe('Dsn', () => {
17
17
expect ( dsn . pass ) . toBe ( 'xyz' ) ;
18
18
expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
19
19
expect ( dsn . port ) . toBe ( '1234' ) ;
20
- expect ( dsn . projectId ) . toBe ( '123' ) ;
21
20
expect ( dsn . path ) . toBe ( '' ) ;
21
+ expect ( dsn . projectId ) . toBe ( '123' ) ;
22
22
} ) ;
23
23
24
24
test ( 'applies partial components' , ( ) => {
@@ -33,8 +33,8 @@ describe('Dsn', () => {
33
33
expect ( dsn . pass ) . toBe ( '' ) ;
34
34
expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
35
35
expect ( dsn . port ) . toBe ( '' ) ;
36
- expect ( dsn . projectId ) . toBe ( '123' ) ;
37
36
expect ( dsn . path ) . toBe ( '' ) ;
37
+ expect ( dsn . projectId ) . toBe ( '123' ) ;
38
38
} ) ;
39
39
40
40
test ( 'throws for missing components' , ( ) => {
@@ -107,8 +107,8 @@ describe('Dsn', () => {
107
107
expect ( dsn . pass ) . toBe ( 'xyz' ) ;
108
108
expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
109
109
expect ( dsn . port ) . toBe ( '1234' ) ;
110
- expect ( dsn . projectId ) . toBe ( '123' ) ;
111
110
expect ( dsn . path ) . toBe ( '' ) ;
111
+ expect ( dsn . projectId ) . toBe ( '123' ) ;
112
112
} ) ;
113
113
114
114
test ( 'parses a valid partial Dsn' , ( ) => {
@@ -133,6 +133,17 @@ describe('Dsn', () => {
133
133
expect ( dsn . projectId ) . toBe ( '321' ) ;
134
134
} ) ;
135
135
136
+ test ( 'with a query string' , ( ) => {
137
+ const dsn = new Dsn ( 'https://[email protected] /321?sample.rate=0.1&other=value' ) ;
138
+ expect ( dsn . protocol ) . toBe ( 'https' ) ;
139
+ expect ( dsn . user ) . toBe ( 'abc' ) ;
140
+ expect ( dsn . pass ) . toBe ( '' ) ;
141
+ expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
142
+ expect ( dsn . port ) . toBe ( '' ) ;
143
+ expect ( dsn . path ) . toBe ( '' ) ;
144
+ expect ( dsn . projectId ) . toBe ( '321' ) ;
145
+ } ) ;
146
+
136
147
test ( 'throws when provided invalid Dsn' , ( ) => {
137
148
expect ( ( ) => new Dsn ( '[email protected] ' ) ) . toThrow ( SentryError ) ;
138
149
} ) ;
@@ -147,6 +158,7 @@ describe('Dsn', () => {
147
158
test ( 'throws for invalid fields' , ( ) => {
148
159
expect ( ( ) => new Dsn ( 'httpx://[email protected] /123' ) ) . toThrow ( SentryError ) ;
149
160
expect ( ( ) => new Dsn ( 'httpx://[email protected] :xxx/123' ) ) . toThrow ( SentryError ) ;
161
+ expect ( ( ) => new Dsn ( 'http://[email protected] /abc' ) ) . toThrow ( SentryError ) ;
150
162
} ) ;
151
163
} ) ;
152
164
0 commit comments