Skip to content

Commit 277a9c2

Browse files
committed
chore: update testdata
1 parent ede5de4 commit 277a9c2

File tree

1 file changed

+88
-46
lines changed

1 file changed

+88
-46
lines changed

src/testdata/urlpatterntestdata.json

Lines changed: 88 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,26 @@
6060
{
6161
"pattern": [{ "pathname": "/foo/bar" }],
6262
"inputs": [{ "pathname": "/foo/bar/baz",
63-
"baseURL": "https://example.com" }],
63+
"baseURL": "https://example.com" }],
6464
"expected_match": null
6565
},
6666
{
6767
"pattern": [{ "pathname": "/foo/bar",
68-
"baseURL": "https://example.com?query#hash" }],
68+
"baseURL": "https://example.com?query#hash" }],
6969
"inputs": [{ "pathname": "/foo/bar" }],
7070
"expected_match": null
7171
},
7272
{
7373
"pattern": [{ "pathname": "/foo/bar",
74-
"baseURL": "https://example.com?query#hash" }],
74+
"baseURL": "https://example.com?query#hash" }],
7575
"inputs": [{ "hostname": "example.com", "pathname": "/foo/bar" }],
7676
"expected_match": null
7777
},
7878
{
7979
"pattern": [{ "pathname": "/foo/bar",
80-
"baseURL": "https://example.com?query#hash" }],
80+
"baseURL": "https://example.com?query#hash" }],
8181
"inputs": [{ "protocol": "https", "hostname": "example.com",
82-
"pathname": "/foo/bar" }],
82+
"pathname": "/foo/bar" }],
8383
"exactly_empty_components": [ "port" ],
8484
"expected_match": {
8585
"hostname": { "input": "example.com", "groups": {} },
@@ -89,9 +89,9 @@
8989
},
9090
{
9191
"pattern": [{ "pathname": "/foo/bar",
92-
"baseURL": "https://example.com" }],
92+
"baseURL": "https://example.com" }],
9393
"inputs": [{ "protocol": "https", "hostname": "example.com",
94-
"pathname": "/foo/bar" }],
94+
"pathname": "/foo/bar" }],
9595
"exactly_empty_components": [ "port" ],
9696
"expected_match": {
9797
"hostname": { "input": "example.com", "groups": {} },
@@ -101,17 +101,17 @@
101101
},
102102
{
103103
"pattern": [{ "pathname": "/foo/bar",
104-
"baseURL": "https://example.com" }],
104+
"baseURL": "https://example.com" }],
105105
"inputs": [{ "protocol": "https", "hostname": "example.com",
106-
"pathname": "/foo/bar/baz" }],
106+
"pathname": "/foo/bar/baz" }],
107107
"expected_match": null
108108
},
109109
{
110110
"pattern": [{ "pathname": "/foo/bar",
111-
"baseURL": "https://example.com?query#hash" }],
111+
"baseURL": "https://example.com?query#hash" }],
112112
"inputs": [{ "protocol": "https", "hostname": "example.com",
113-
"pathname": "/foo/bar", "search": "otherquery",
114-
"hash": "otherhash" }],
113+
"pathname": "/foo/bar", "search": "otherquery",
114+
"hash": "otherhash" }],
115115
"exactly_empty_components": [ "port" ],
116116
"expected_match": {
117117
"hash": { "input": "otherhash", "groups": { "0": "otherhash" } },
@@ -123,10 +123,10 @@
123123
},
124124
{
125125
"pattern": [{ "pathname": "/foo/bar",
126-
"baseURL": "https://example.com" }],
126+
"baseURL": "https://example.com" }],
127127
"inputs": [{ "protocol": "https", "hostname": "example.com",
128-
"pathname": "/foo/bar", "search": "otherquery",
129-
"hash": "otherhash" }],
128+
"pathname": "/foo/bar", "search": "otherquery",
129+
"hash": "otherhash" }],
130130
"exactly_empty_components": [ "port" ],
131131
"expected_match": {
132132
"hash": { "input": "otherhash", "groups": { "0": "otherhash" } },
@@ -138,10 +138,10 @@
138138
},
139139
{
140140
"pattern": [{ "pathname": "/foo/bar",
141-
"baseURL": "https://example.com?otherquery#otherhash" }],
141+
"baseURL": "https://example.com?otherquery#otherhash" }],
142142
"inputs": [{ "protocol": "https", "hostname": "example.com",
143-
"pathname": "/foo/bar", "search": "otherquery",
144-
"hash": "otherhash" }],
143+
"pathname": "/foo/bar", "search": "otherquery",
144+
"hash": "otherhash" }],
145145
"exactly_empty_components": [ "port" ],
146146
"expected_match": {
147147
"hash": { "input": "otherhash", "groups": { "0": "otherhash" } },
@@ -153,7 +153,7 @@
153153
},
154154
{
155155
"pattern": [{ "pathname": "/foo/bar",
156-
"baseURL": "https://example.com?query#hash" }],
156+
"baseURL": "https://example.com?query#hash" }],
157157
"inputs": [ "https://example.com/foo/bar" ],
158158
"exactly_empty_components": [ "port" ],
159159
"expected_match": {
@@ -164,7 +164,7 @@
164164
},
165165
{
166166
"pattern": [{ "pathname": "/foo/bar",
167-
"baseURL": "https://example.com?query#hash" }],
167+
"baseURL": "https://example.com?query#hash" }],
168168
"inputs": [ "https://example.com/foo/bar?otherquery#otherhash" ],
169169
"exactly_empty_components": [ "port" ],
170170
"expected_match": {
@@ -177,7 +177,7 @@
177177
},
178178
{
179179
"pattern": [{ "pathname": "/foo/bar",
180-
"baseURL": "https://example.com?query#hash" }],
180+
"baseURL": "https://example.com?query#hash" }],
181181
"inputs": [ "https://example.com/foo/bar?query#hash" ],
182182
"exactly_empty_components": [ "port" ],
183183
"expected_match": {
@@ -190,25 +190,25 @@
190190
},
191191
{
192192
"pattern": [{ "pathname": "/foo/bar",
193-
"baseURL": "https://example.com?query#hash" }],
193+
"baseURL": "https://example.com?query#hash" }],
194194
"inputs": [ "https://example.com/foo/bar/baz" ],
195195
"expected_match": null
196196
},
197197
{
198198
"pattern": [{ "pathname": "/foo/bar",
199-
"baseURL": "https://example.com?query#hash" }],
199+
"baseURL": "https://example.com?query#hash" }],
200200
"inputs": [ "https://other.com/foo/bar" ],
201201
"expected_match": null
202202
},
203203
{
204204
"pattern": [{ "pathname": "/foo/bar",
205-
"baseURL": "https://example.com?query#hash" }],
205+
"baseURL": "https://example.com?query#hash" }],
206206
"inputs": [ "http://other.com/foo/bar" ],
207207
"expected_match": null
208208
},
209209
{
210210
"pattern": [{ "pathname": "/foo/bar",
211-
"baseURL": "https://example.com?query#hash" }],
211+
"baseURL": "https://example.com?query#hash" }],
212212
"inputs": [{ "pathname": "/foo/bar", "baseURL": "https://example.com" }],
213213
"exactly_empty_components": [ "port" ],
214214
"expected_match": {
@@ -219,9 +219,9 @@
219219
},
220220
{
221221
"pattern": [{ "pathname": "/foo/bar",
222-
"baseURL": "https://example.com?query#hash" }],
222+
"baseURL": "https://example.com?query#hash" }],
223223
"inputs": [{ "pathname": "/foo/bar",
224-
"baseURL": "https://example.com?query#hash" }],
224+
"baseURL": "https://example.com?query#hash" }],
225225
"exactly_empty_components": [ "port" ],
226226
"expected_match": {
227227
"hostname": { "input": "example.com", "groups": {} },
@@ -231,20 +231,20 @@
231231
},
232232
{
233233
"pattern": [{ "pathname": "/foo/bar",
234-
"baseURL": "https://example.com?query#hash" }],
234+
"baseURL": "https://example.com?query#hash" }],
235235
"inputs": [{ "pathname": "/foo/bar/baz",
236-
"baseURL": "https://example.com" }],
236+
"baseURL": "https://example.com" }],
237237
"expected_match": null
238238
},
239239
{
240240
"pattern": [{ "pathname": "/foo/bar",
241-
"baseURL": "https://example.com?query#hash" }],
241+
"baseURL": "https://example.com?query#hash" }],
242242
"inputs": [{ "pathname": "/foo/bar", "baseURL": "https://other.com" }],
243243
"expected_match": null
244244
},
245245
{
246246
"pattern": [{ "pathname": "/foo/bar",
247-
"baseURL": "https://example.com?query#hash" }],
247+
"baseURL": "https://example.com?query#hash" }],
248248
"inputs": [{ "pathname": "/foo/bar", "baseURL": "http://example.com" }],
249249
"expected_match": null
250250
},
@@ -1556,7 +1556,7 @@
15561556
{
15571557
"pattern": [ "https://example.com:8080/foo?bar#baz" ],
15581558
"inputs": [{ "pathname": "/foo", "search": "bar", "hash": "baz",
1559-
"baseURL": "https://example.com:8080" }],
1559+
"baseURL": "https://example.com:8080" }],
15601560
"expected_obj": {
15611561
"protocol": "https",
15621562
"username": "*",
@@ -1579,7 +1579,7 @@
15791579
{
15801580
"pattern": [ "/foo?bar#baz", "https://example.com:8080" ],
15811581
"inputs": [{ "pathname": "/foo", "search": "bar", "hash": "baz",
1582-
"baseURL": "https://example.com:8080" }],
1582+
"baseURL": "https://example.com:8080" }],
15831583
"expected_obj": {
15841584
"pathname": "/foo",
15851585
"search": "bar",
@@ -1615,7 +1615,7 @@
16151615
"protocol": { "input": "https", "groups": {} },
16161616
"hostname": { "input": "sub.example.com", "groups": { "0": "sub" } },
16171617
"pathname": { "input": "/foo/bar", "groups": { "product": "foo",
1618-
"endpoint": "bar" } }
1618+
"endpoint": "bar" } }
16191619
}
16201620
},
16211621
{
@@ -1994,9 +1994,9 @@
19941994
{
19951995
"pattern": [ "https://example.com/foo?bar#baz" ],
19961996
"inputs": [{ "protocol": "https:",
1997-
"search": "?bar",
1998-
"hash": "#baz",
1999-
"baseURL": "http://example.com/foo" }],
1997+
"search": "?bar",
1998+
"hash": "#baz",
1999+
"baseURL": "http://example.com/foo" }],
20002000
"exactly_empty_components": [ "port" ],
20012001
"expected_obj": {
20022002
"protocol": "https",
@@ -2009,8 +2009,8 @@
20092009
},
20102010
{
20112011
"pattern": [{ "protocol": "http{s}?:",
2012-
"search": "?bar",
2013-
"hash": "#baz" }],
2012+
"search": "?bar",
2013+
"hash": "#baz" }],
20142014
"inputs": [ "http://example.com/foo?bar#baz" ],
20152015
"expected_obj": {
20162016
"protocol": "http{s}?",
@@ -2855,9 +2855,9 @@
28552855
},
28562856
{
28572857
"pattern": [ "https://example.com:8080/foo?bar#baz",
2858-
{ "ignoreCase": true }],
2858+
{ "ignoreCase": true }],
28592859
"inputs": [{ "pathname": "/FOO", "search": "BAR", "hash": "BAZ",
2860-
"baseURL": "https://example.com:8080" }],
2860+
"baseURL": "https://example.com:8080" }],
28612861
"expected_obj": {
28622862
"protocol": "https",
28632863
"hostname": "example.com",
@@ -2877,9 +2877,9 @@
28772877
},
28782878
{
28792879
"pattern": [ "/foo?bar#baz", "https://example.com:8080",
2880-
{ "ignoreCase": true }],
2880+
{ "ignoreCase": true }],
28812881
"inputs": [{ "pathname": "/FOO", "search": "BAR", "hash": "BAZ",
2882-
"baseURL": "https://example.com:8080" }],
2882+
"baseURL": "https://example.com:8080" }],
28832883
"expected_obj": {
28842884
"protocol": "https",
28852885
"hostname": "example.com",
@@ -2899,9 +2899,9 @@
28992899
},
29002900
{
29012901
"pattern": [ "/foo?bar#baz", { "ignoreCase": true },
2902-
"https://example.com:8080" ],
2902+
"https://example.com:8080" ],
29032903
"inputs": [{ "pathname": "/FOO", "search": "BAR", "hash": "BAZ",
2904-
"baseURL": "https://example.com:8080" }],
2904+
"baseURL": "https://example.com:8080" }],
29052905
"expected_obj": "error"
29062906
},
29072907
{
@@ -2961,7 +2961,7 @@
29612961
"pathname": { "input": "/z", "groups": { "0": "z" } }
29622962
}
29632963
},
2964-
{
2964+
{
29652965
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
29662966
"inputs": [{ "pathname": "/0" }],
29672967
"expected_match": {
@@ -2972,5 +2972,47 @@
29722972
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
29732973
"inputs": [{ "pathname": "/3" }],
29742974
"expected_match": null
2975+
},
2976+
{
2977+
"pattern": [{ "protocol": "http", "hostname": "example.com/ignoredpath" }],
2978+
"inputs": ["http://example.com/"],
2979+
"expected_obj": {
2980+
"protocol": "http",
2981+
"hostname": "example.com",
2982+
"pathname": "*"
2983+
},
2984+
"expected_match": {
2985+
"protocol": { "input": "http", "groups": {} },
2986+
"hostname": { "input": "example.com", "groups": {} },
2987+
"pathname": { "input": "/", "groups": { "0": "/" } }
2988+
}
2989+
},
2990+
{
2991+
"pattern": [{ "protocol": "http", "hostname": "example.com\\?ignoredsearch" }],
2992+
"inputs": ["http://example.com/"],
2993+
"expected_obj": {
2994+
"protocol": "http",
2995+
"hostname": "example.com",
2996+
"search": "*"
2997+
},
2998+
"expected_match": {
2999+
"protocol": { "input": "http", "groups": {} },
3000+
"hostname": { "input": "example.com", "groups": {} },
3001+
"pathname": { "input": "/", "groups": { "0": "/" } }
3002+
}
3003+
},
3004+
{
3005+
"pattern": [{ "protocol": "http", "hostname": "example.com#ignoredhash" }],
3006+
"inputs": ["http://example.com/"],
3007+
"expected_obj": {
3008+
"protocol": "http",
3009+
"hostname": "example.com",
3010+
"hash": "*"
3011+
},
3012+
"expected_match": {
3013+
"protocol": { "input": "http", "groups": {} },
3014+
"hostname": { "input": "example.com", "groups": {} },
3015+
"pathname": { "input": "/", "groups": { "0": "/" } }
3016+
}
29753017
}
29763018
]

0 commit comments

Comments
 (0)