@@ -111,7 +111,7 @@ test('stripWWW option', t => {
111
111
test ( 'removeQueryParameters option' , t => {
112
112
const options = {
113
113
stripWWW : false ,
114
- removeQueryParameters : [ / ^ u t m _ \w + / i, 'ref' ]
114
+ removeQueryParameters : [ / ^ u t m _ \w + / i, 'ref' ] ,
115
115
} ;
116
116
t . is ( normalizeUrl ( 'www.sindresorhus.com?foo=bar&utm_medium=test' ) , 'http://sindresorhus.com/?foo=bar' ) ;
117
117
t . is ( normalizeUrl ( 'http://www.sindresorhus.com' , options ) , 'http://www.sindresorhus.com' ) ;
@@ -122,7 +122,7 @@ test('removeQueryParameters option', t => {
122
122
test ( 'removeQueryParameters boolean `true` option' , t => {
123
123
const options = {
124
124
stripWWW : false ,
125
- removeQueryParameters : true
125
+ removeQueryParameters : true ,
126
126
} ;
127
127
128
128
t . is ( normalizeUrl ( 'http://www.sindresorhus.com' , options ) , 'http://www.sindresorhus.com' ) ;
@@ -133,7 +133,7 @@ test('removeQueryParameters boolean `true` option', t => {
133
133
test ( 'removeQueryParameters boolean `false` option' , t => {
134
134
const options = {
135
135
stripWWW : false ,
136
- removeQueryParameters : false
136
+ removeQueryParameters : false ,
137
137
} ;
138
138
139
139
t . is ( normalizeUrl ( 'http://www.sindresorhus.com' , options ) , 'http://www.sindresorhus.com' ) ;
@@ -153,7 +153,7 @@ test('forceHttp option with forceHttps', t => {
153
153
t . throws ( ( ) => {
154
154
normalizeUrl ( 'https://www.sindresorhus.com' , { forceHttp : true , forceHttps : true } ) ;
155
155
} , {
156
- message : 'The `forceHttp` and `forceHttps` options cannot be used together'
156
+ message : 'The `forceHttp` and `forceHttps` options cannot be used together' ,
157
157
} ) ;
158
158
} ) ;
159
159
@@ -231,7 +231,7 @@ test('removeDirectoryIndex option', t => {
231
231
test ( 'removeTrailingSlash and removeDirectoryIndex options)' , t => {
232
232
const options1 = {
233
233
removeTrailingSlash : true ,
234
- removeDirectoryIndex : true
234
+ removeDirectoryIndex : true ,
235
235
} ;
236
236
t . is ( normalizeUrl ( 'http://sindresorhus.com/path/' , options1 ) , 'http://sindresorhus.com/path' ) ;
237
237
t . is ( normalizeUrl ( 'http://sindresorhus.com/path/index.html' , options1 ) , 'http://sindresorhus.com/path' ) ;
@@ -240,7 +240,7 @@ test('removeTrailingSlash and removeDirectoryIndex options)', t => {
240
240
241
241
const options2 = {
242
242
removeTrailingSlash : false ,
243
- removeDirectoryIndex : true
243
+ removeDirectoryIndex : true ,
244
244
} ;
245
245
t . is ( normalizeUrl ( 'http://sindresorhus.com/path/' , options2 ) , 'http://sindresorhus.com/path/' ) ;
246
246
t . is ( normalizeUrl ( 'http://sindresorhus.com/path/index.html' , options2 ) , 'http://sindresorhus.com/path/' ) ;
@@ -249,15 +249,15 @@ test('removeTrailingSlash and removeDirectoryIndex options)', t => {
249
249
250
250
test ( 'sortQueryParameters option' , t => {
251
251
const options1 = {
252
- sortQueryParameters : true
252
+ sortQueryParameters : true ,
253
253
} ;
254
254
t . is ( normalizeUrl ( 'http://sindresorhus.com/?a=Z&b=Y&c=X&d=W' , options1 ) , 'http://sindresorhus.com/?a=Z&b=Y&c=X&d=W' ) ;
255
255
t . is ( normalizeUrl ( 'http://sindresorhus.com/?b=Y&c=X&a=Z&d=W' , options1 ) , 'http://sindresorhus.com/?a=Z&b=Y&c=X&d=W' ) ;
256
256
t . is ( normalizeUrl ( 'http://sindresorhus.com/?a=Z&d=W&b=Y&c=X' , options1 ) , 'http://sindresorhus.com/?a=Z&b=Y&c=X&d=W' ) ;
257
257
t . is ( normalizeUrl ( 'http://sindresorhus.com/' , options1 ) , 'http://sindresorhus.com' ) ;
258
258
259
259
const options2 = {
260
- sortQueryParameters : false
260
+ sortQueryParameters : false ,
261
261
} ;
262
262
t . is ( normalizeUrl ( 'http://sindresorhus.com/?a=Z&b=Y&c=X&d=W' , options2 ) , 'http://sindresorhus.com/?a=Z&b=Y&c=X&d=W' ) ;
263
263
t . is ( normalizeUrl ( 'http://sindresorhus.com/?b=Y&c=X&a=Z&d=W' , options2 ) , 'http://sindresorhus.com/?b=Y&c=X&a=Z&d=W' ) ;
@@ -269,19 +269,19 @@ test('invalid urls', t => {
269
269
t . throws ( ( ) => {
270
270
normalizeUrl ( 'http://' ) ;
271
271
} , {
272
- message : 'Invalid URL'
272
+ message : 'Invalid URL' ,
273
273
} ) ;
274
274
275
275
t . throws ( ( ) => {
276
276
normalizeUrl ( '/' ) ;
277
277
} , {
278
- message : 'Invalid URL'
278
+ message : 'Invalid URL' ,
279
279
} ) ;
280
280
281
281
t . throws ( ( ) => {
282
282
normalizeUrl ( '/relative/path/' ) ;
283
283
} , {
284
- message : 'Invalid URL'
284
+ message : 'Invalid URL' ,
285
285
} ) ;
286
286
} ) ;
287
287
@@ -309,8 +309,10 @@ test('remove duplicate pathname slashes', t => {
309
309
310
310
test ( 'data URL' , t => {
311
311
// Invalid URL.
312
- t . throws ( ( ) => normalizeUrl ( 'data:' ) , {
313
- message : 'Invalid URL: data:'
312
+ t . throws ( ( ) => {
313
+ normalizeUrl ( 'data:' ) ;
314
+ } , {
315
+ message : 'Invalid URL: data:' ,
314
316
} ) ;
315
317
316
318
// Strip default MIME type
@@ -357,7 +359,7 @@ test('data URL', t => {
357
359
removeQueryParameters : [ / ^ u t m _ \w + / i, 'ref' ] ,
358
360
sortQueryParameters : true ,
359
361
removeTrailingSlash : true ,
360
- removeDirectoryIndex : true
362
+ removeDirectoryIndex : true ,
361
363
} ;
362
364
t . is ( normalizeUrl ( 'data:,sindresorhus.com/' , options ) , 'data:,sindresorhus.com/' ) ;
363
365
t . is ( normalizeUrl ( 'data:,sindresorhus.com/index.html' , options ) , 'data:,sindresorhus.com/index.html' ) ;
@@ -375,7 +377,7 @@ test('view-source URL', t => {
375
377
t . throws ( ( ) => {
376
378
normalizeUrl ( 'view-source:https://www.sindresorhus.com' ) ;
377
379
} , {
378
- message : '`view-source:` is not supported as it is a non-standard protocol'
380
+ message : '`view-source:` is not supported as it is a non-standard protocol' ,
379
381
} ) ;
380
382
} ) ;
381
383
0 commit comments