@@ -24,7 +24,7 @@ expect.extend({
24
24
// biome-ignore lint/correctness/noSelfAssign:
25
25
expected . hash = expected . hash ;
26
26
return {
27
- message : ( ) => `输出 ${ received . href } 应该为 ${ expected . href } ` ,
27
+ message : ( ) => `expected ${ received . href } to be ${ expected . href } ` ,
28
28
pass : received . href === expected . href
29
29
} ;
30
30
}
@@ -41,37 +41,39 @@ describe('normalizeURL', () => {
41
41
input : '//example.com/path' ,
42
42
base : 'https://github.com' ,
43
43
expected : 'http://example.com/path' ,
44
- description : '应该处理协议相对路径(以//开头)'
44
+ description :
45
+ 'should handle protocol-relative URLs (starting with //)'
45
46
} ,
46
47
{
47
48
input : 'http://github.com/path?a#h' ,
48
49
base : 'http://example.com' ,
49
50
expected : 'http://github.com/path?a#h' ,
50
- description : '应该处理绝对URL '
51
+ description : 'should handle absolute URLs '
51
52
} ,
52
53
{
53
54
input : '/path' ,
54
55
base : 'http://example.com/en/' ,
55
56
expected : 'http://example.com/en/path' ,
56
- description : '应该处理带基URL的相对路径 '
57
+ description : 'should handle relative paths with a base URL '
57
58
} ,
58
59
{
59
60
input : 'github.com' ,
60
61
base : 'http://example.com' ,
61
62
expected : 'http://example.com/github.com' ,
62
- description : '裸域名应该当做相对路径处理 '
63
+ description : 'should treat bare domains as relative paths '
63
64
} ,
64
65
{
65
66
input : new URL ( 'http://example.com/path' ) ,
66
67
base : 'http://example.com' ,
67
68
expected : 'http://example.com/path' ,
68
- description : '应该处理URL对象 '
69
+ description : 'should handle URL objects '
69
70
} ,
70
71
{
71
72
input : '-a://example.com' ,
72
73
base : 'http://example.com' ,
73
74
expected : 'http://example.com/-a://example.com' ,
74
- description : '协议开头但解析失败后应该当做相对路径'
75
+ description :
76
+ 'should treat strings that fail to parse as a protocol as relative paths'
75
77
}
76
78
] ;
77
79
@@ -94,19 +96,19 @@ describe('parseLocation', () => {
94
96
input : '/products' ,
95
97
base : 'http://example.com' ,
96
98
expected : 'http://example.com/products' ,
97
- description : '应该处理字符串路径 '
99
+ description : 'should handle string paths '
98
100
} ,
99
101
{
100
102
input : { path : '/products' } ,
101
103
base : 'http://example.com' ,
102
104
expected : 'http://example.com/products' ,
103
- description : '应该处理带path属性的对象 '
105
+ description : 'should handle objects with a path property '
104
106
} ,
105
107
{
106
108
input : { url : '/products' } ,
107
109
base : 'http://example.com' ,
108
110
expected : 'http://example.com/products' ,
109
- description : '应该处理带url属性的对象 '
111
+ description : 'should handle objects with a url property '
110
112
} ,
111
113
{
112
114
input : {
@@ -115,19 +117,19 @@ describe('parseLocation', () => {
115
117
} ,
116
118
base : 'http://example.com' ,
117
119
expected : 'http://example.com/products?id=123&category=electronics' ,
118
- description : '应该处理带query参数的对象 '
120
+ description : 'should handle objects with query parameters '
119
121
} ,
120
122
{
121
123
input : { path : '/products' , query : { id : '123' } , hash : 'details' } ,
122
124
base : 'http://example.com' ,
123
125
expected : 'http://example.com/products?id=123#details' ,
124
- description : '应该处理带hash的对象 '
126
+ description : 'should handle objects with a hash '
125
127
} ,
126
128
{
127
129
input : { path : '/products' , queryArray : { tag : [ 'new' , 'sale' ] } } ,
128
130
base : 'http://example.com' ,
129
131
expected : 'http://example.com/products?tag=new&tag=sale' ,
130
- description : '应该处理带queryArray的对象 '
132
+ description : 'should handle objects with queryArray '
131
133
} ,
132
134
{
133
135
input : {
@@ -139,7 +141,7 @@ describe('parseLocation', () => {
139
141
base : 'http://example.com' ,
140
142
expected :
141
143
'http://example.com/products?id=123&category=electronics&tag=new&tag=sale#details' ,
142
- description : '应该处理带所有属性的复杂对象 '
144
+ description : 'should handle complex objects with all properties '
143
145
} ,
144
146
{
145
147
input : {
@@ -148,7 +150,7 @@ describe('parseLocation', () => {
148
150
} ,
149
151
base : 'http://example.com' ,
150
152
expected : 'http://example.com/products#a?a' ,
151
- description : '特殊 hash 字符应该被正确处理 '
153
+ description : 'should handle special hash characters correctly '
152
154
} ,
153
155
{
154
156
input : {
@@ -157,7 +159,7 @@ describe('parseLocation', () => {
157
159
} ,
158
160
base : 'http://example.com' ,
159
161
expected : 'http://example.com/products#a?a#b' ,
160
- description : '特殊 hash 字符应该被正确处理 '
162
+ description : 'should handle special hash characters correctly '
161
163
} ,
162
164
{
163
165
input : {
@@ -180,13 +182,14 @@ describe('parseLocation', () => {
180
182
expected : `http://example.com/products?symbol=Symbol()&fn=${ String (
181
183
async ( ) => ''
182
184
) } &obj=${ String ( { } ) } &big=12345678901234567891234567890123456789&b&c=0&d=0&e=1`,
183
- description : '应该忽略null、undefined和NaN的query参数'
185
+ description :
186
+ 'should ignore null, undefined, and NaN query parameters'
184
187
} ,
185
188
{
186
189
input : { path : '/products' , queryArray : { tag : [ ] } } ,
187
190
base : 'http://example.com' ,
188
191
expected : 'http://example.com/products' ,
189
- description : '应该处理空queryArray '
192
+ description : 'should handle empty queryArray '
190
193
} ,
191
194
{
192
195
input : {
@@ -195,7 +198,7 @@ describe('parseLocation', () => {
195
198
} ,
196
199
base : 'http://example.com' ,
197
200
expected : 'http://example.com/products?id=query&a' ,
198
- description : 'query的值应覆盖path中的query参数 '
201
+ description : 'query value should override query parameter in path '
199
202
} ,
200
203
{
201
204
input : {
@@ -205,7 +208,8 @@ describe('parseLocation', () => {
205
208
} ,
206
209
base : 'http://example.com' ,
207
210
expected : 'http://example.com/products?id=queryArray&a' ,
208
- description : 'queryArray的值应覆盖query和path中的query参数'
211
+ description :
212
+ 'queryArray value should override query and path parameters'
209
213
} ,
210
214
{
211
215
input : {
@@ -214,7 +218,8 @@ describe('parseLocation', () => {
214
218
} ,
215
219
base : 'http://example.com' ,
216
220
expected : 'http://example.com/products?id=queryArray&a' ,
217
- description : 'queryArray的值应覆盖path中的query参数'
221
+ description :
222
+ 'queryArray value should override query parameter in path'
218
223
} ,
219
224
{
220
225
input : {
@@ -224,7 +229,8 @@ describe('parseLocation', () => {
224
229
} ,
225
230
base : 'http://example.com' ,
226
231
expected : 'http://example.com?a&a' ,
227
- description : '应正确处理空字符串和重复的query参数'
232
+ description :
233
+ 'should handle empty strings and duplicate query parameters correctly'
228
234
} ,
229
235
{
230
236
input : { path : '/products?id=123' , url : '/products?id=456' } ,
0 commit comments