@@ -7,8 +7,8 @@ describe('DSN', () => {
7
7
const dsn = new DSN ( {
8
8
host : 'sentry.io' ,
9
9
pass : 'xyz' ,
10
- path : '123' ,
11
10
port : '1234' ,
11
+ projectId : '123' ,
12
12
protocol : 'https' ,
13
13
user : 'abc' ,
14
14
} ) ;
@@ -17,13 +17,14 @@ 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 . path ) . toBe ( '123' ) ;
20
+ expect ( dsn . projectId ) . toBe ( '123' ) ;
21
+ expect ( dsn . path ) . toBe ( '' ) ;
21
22
} ) ;
22
23
23
24
test ( 'applies partial components' , ( ) => {
24
25
const dsn = new DSN ( {
25
26
host : 'sentry.io' ,
26
- path : '123' ,
27
+ projectId : '123' ,
27
28
protocol : 'https' ,
28
29
user : 'abc' ,
29
30
} ) ;
@@ -32,15 +33,16 @@ describe('DSN', () => {
32
33
expect ( dsn . pass ) . toBe ( '' ) ;
33
34
expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
34
35
expect ( dsn . port ) . toBe ( '' ) ;
35
- expect ( dsn . path ) . toBe ( '123' ) ;
36
+ expect ( dsn . projectId ) . toBe ( '123' ) ;
37
+ expect ( dsn . path ) . toBe ( '' ) ;
36
38
} ) ;
37
39
38
40
test ( 'throws for missing components' , ( ) => {
39
41
expect (
40
42
( ) =>
41
43
new DSN ( {
42
44
host : '' ,
43
- path : '123' ,
45
+ projectId : '123' ,
44
46
protocol : 'https' ,
45
47
user : 'abc' ,
46
48
} ) ,
@@ -49,7 +51,7 @@ describe('DSN', () => {
49
51
( ) =>
50
52
new DSN ( {
51
53
host : 'sentry.io' ,
52
- path : '' ,
54
+ projectId : '' ,
53
55
protocol : 'https' ,
54
56
user : 'abc' ,
55
57
} ) ,
@@ -58,7 +60,7 @@ describe('DSN', () => {
58
60
( ) =>
59
61
new DSN ( {
60
62
host : 'sentry.io' ,
61
- path : '123' ,
63
+ projectId : '123' ,
62
64
protocol : '' as 'http' , // Trick the type checker here
63
65
user : 'abc' ,
64
66
} ) ,
@@ -67,7 +69,7 @@ describe('DSN', () => {
67
69
( ) =>
68
70
new DSN ( {
69
71
host : 'sentry.io' ,
70
- path : '123' ,
72
+ projectId : '123' ,
71
73
protocol : 'https' ,
72
74
user : '' ,
73
75
} ) ,
@@ -79,7 +81,7 @@ describe('DSN', () => {
79
81
( ) =>
80
82
new DSN ( {
81
83
host : 'sentry.io' ,
82
- path : '123' ,
84
+ projectId : '123' ,
83
85
protocol : 'httpx' as 'http' , // Trick the type checker here
84
86
user : 'abc' ,
85
87
} ) ,
@@ -88,8 +90,8 @@ describe('DSN', () => {
88
90
( ) =>
89
91
new DSN ( {
90
92
host : 'sentry.io' ,
91
- path : '123' ,
92
93
port : 'xxx' ,
94
+ projectId : '123' ,
93
95
protocol : 'https' ,
94
96
user : 'abc' ,
95
97
} ) ,
@@ -105,17 +107,32 @@ describe('DSN', () => {
105
107
expect ( dsn . pass ) . toBe ( 'xyz' ) ;
106
108
expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
107
109
expect ( dsn . port ) . toBe ( '1234' ) ;
108
- expect ( dsn . path ) . toBe ( '123' ) ;
110
+ expect ( dsn . projectId ) . toBe ( '123' ) ;
111
+ expect ( dsn . path ) . toBe ( '' ) ;
109
112
} ) ;
110
113
111
114
test ( 'parses a valid partial DSN' , ( ) => {
112
- const dsn = new DSN ( 'https://[email protected] /123' ) ;
115
+ const dsn = new DSN ( 'https://[email protected] /123/321 ' ) ;
113
116
expect ( dsn . protocol ) . toBe ( 'https' ) ;
114
117
expect ( dsn . user ) . toBe ( 'abc' ) ;
115
118
expect ( dsn . pass ) . toBe ( '' ) ;
116
119
expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
117
120
expect ( dsn . port ) . toBe ( '' ) ;
118
121
expect ( dsn . path ) . toBe ( '123' ) ;
122
+ expect ( dsn . projectId ) . toBe ( '321' ) ;
123
+ } ) ;
124
+
125
+ test ( 'with a long path' , ( ) => {
126
+ const dsn = new DSN (
127
+ 'https://[email protected] /sentry/custom/installation/321' ,
128
+ ) ;
129
+ expect ( dsn . protocol ) . toBe ( 'https' ) ;
130
+ expect ( dsn . user ) . toBe ( 'abc' ) ;
131
+ expect ( dsn . pass ) . toBe ( '' ) ;
132
+ expect ( dsn . host ) . toBe ( 'sentry.io' ) ;
133
+ expect ( dsn . port ) . toBe ( '' ) ;
134
+ expect ( dsn . path ) . toBe ( 'sentry/custom/installation' ) ;
135
+ expect ( dsn . projectId ) . toBe ( '321' ) ;
119
136
} ) ;
120
137
121
138
test ( 'throws when provided invalid DSN' , ( ) => {
@@ -157,5 +174,14 @@ describe('DSN', () => {
157
174
const dsn = new DSN ( 'https://[email protected] /123' ) ;
158
175
expect ( dsn . toString ( ) ) . toBe ( 'https://[email protected] /123' ) ;
159
176
} ) ;
177
+
178
+ test ( 'renders the full path correctly' , ( ) => {
179
+ const dsn = new DSN (
180
+ 'https://[email protected] /sentry/custom/installation/321' ,
181
+ ) ;
182
+ expect ( dsn . toString ( ) ) . toBe (
183
+ 'https://[email protected] /sentry/custom/installation/321' ,
184
+ ) ;
185
+ } ) ;
160
186
} ) ;
161
187
} ) ;
0 commit comments