@@ -17,8 +17,8 @@ describe('Dsn', () => {
1717 expect ( dsn . pass ) . toBe ( 'xyz' ) ;
1818 expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
1919 expect ( dsn . port ) . toBe ( '1234' ) ;
20- expect ( dsn . projectId ) . toBe ( '123' ) ;
2120 expect ( dsn . path ) . toBe ( '' ) ;
21+ expect ( dsn . projectId ) . toBe ( '123' ) ;
2222 } ) ;
2323
2424 test ( 'applies partial components' , ( ) => {
@@ -33,8 +33,8 @@ describe('Dsn', () => {
3333 expect ( dsn . pass ) . toBe ( '' ) ;
3434 expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
3535 expect ( dsn . port ) . toBe ( '' ) ;
36- expect ( dsn . projectId ) . toBe ( '123' ) ;
3736 expect ( dsn . path ) . toBe ( '' ) ;
37+ expect ( dsn . projectId ) . toBe ( '123' ) ;
3838 } ) ;
3939
4040 test ( 'throws for missing components' , ( ) => {
@@ -107,8 +107,8 @@ describe('Dsn', () => {
107107 expect ( dsn . pass ) . toBe ( 'xyz' ) ;
108108 expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
109109 expect ( dsn . port ) . toBe ( '1234' ) ;
110- expect ( dsn . projectId ) . toBe ( '123' ) ;
111110 expect ( dsn . path ) . toBe ( '' ) ;
111+ expect ( dsn . projectId ) . toBe ( '123' ) ;
112112 } ) ;
113113
114114 test ( 'parses a valid partial Dsn' , ( ) => {
@@ -133,6 +133,17 @@ describe('Dsn', () => {
133133 expect ( dsn . projectId ) . toBe ( '321' ) ;
134134 } ) ;
135135
136+ test ( 'with a query string' , ( ) => {
137+ const dsn = new Dsn ( 'https://abc@sentry.io/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+
136147 test ( 'throws when provided invalid Dsn' , ( ) => {
137148 expect ( ( ) => new Dsn ( 'some@random.dsn' ) ) . toThrow ( SentryError ) ;
138149 } ) ;
@@ -147,6 +158,7 @@ describe('Dsn', () => {
147158 test ( 'throws for invalid fields' , ( ) => {
148159 expect ( ( ) => new Dsn ( 'httpx://abc@sentry.io/123' ) ) . toThrow ( SentryError ) ;
149160 expect ( ( ) => new Dsn ( 'httpx://abc@sentry.io:xxx/123' ) ) . toThrow ( SentryError ) ;
161+ expect ( ( ) => new Dsn ( 'http://abc@sentry.io/abc' ) ) . toThrow ( SentryError ) ;
150162 } ) ;
151163 } ) ;
152164
0 commit comments