@@ -241,36 +241,165 @@ describe('Sanitizers', function () {
241
241
} ,
242
242
} ) ;
243
243
244
+ // Testing all_lowercase switch, should apply to domains not known to be case-insensitive
244
245
test ( {
245
246
sanitizer : 'normalizeEmail' ,
246
- args : [ { lowercase : false } ] ,
247
+ args : [ { all_lowercase : false } ] ,
247
248
expect : {
248
- 'test@me .com' : 'test@me .com' ,
249
+ 'test@foo .com' : 'test@foo .com' ,
249
250
'hans@m端ller.com' : 'hans@m端ller.com' ,
250
- '[email protected] ' :
'[email protected] ' , // Hostname is always lowercased,
251
-
252
-
251
+ '[email protected] ' :
'[email protected] ' , // Hostname is always lowercased
253
252
254
- // Domains that are known for being case-insensitive are always lowercased,
253
+ // In case of domains that are known to be case-insensitive, there's a separate switch
254
+
255
+
255
256
256
257
257
258
259
+
260
+
261
+
262
+
263
+ } ,
264
+ } ) ;
265
+
266
+ // Testing *_lowercase
267
+ test ( {
268
+ sanitizer : 'normalizeEmail' ,
269
+ args : [ {
270
+ all_lowercase : false ,
271
+ gmail_lowercase : false ,
272
+ icloud_lowercase : false ,
273
+ outlookdotcom_lowercase : false ,
274
+ yahoo_lowercase : false ,
275
+ } ] ,
276
+ expect : {
277
+
278
+
279
+
280
+
281
+ '[email protected] ' :
'[email protected] ' , // outlookdotcom_lowercase
282
+ '[email protected] ' :
'[email protected] ' , // outlookdotcom_lowercase
283
+
284
+ } ,
285
+ } ) ;
286
+
287
+ // Testing all_lowercase
288
+ // Should overwrite all the *_lowercase options
289
+ test ( {
290
+ sanitizer : 'normalizeEmail' ,
291
+ args : [ {
292
+ all_lowercase : true ,
293
+ gmail_lowercase : false , // Overruled
294
+ icloud_lowercase : false , // Overruled
295
+ outlookdotcom_lowercase : false , // Overruled
296
+ yahoo_lowercase : false , // Overruled
297
+ } ] ,
298
+ expect : {
299
+
300
+
301
+
302
+
303
+ '[email protected] ' :
'[email protected] ' , // outlookdotcom_lowercase
304
+ '[email protected] ' :
'[email protected] ' , // outlookdotcom_lowercase
305
+
258
306
} ,
259
307
} ) ;
260
308
309
+ // Testing *_remove_dots
261
310
test ( {
262
311
sanitizer : 'normalizeEmail' ,
263
- args : [ { remove_dots : false } ] ,
312
+ args : [ {
313
+ gmail_remove_dots : false ,
314
+ } ] ,
264
315
expect : {
265
316
317
+
318
+
319
+ } ,
320
+ } ) ;
321
+
322
+ test ( {
323
+ sanitizer : 'normalizeEmail' ,
324
+ args : [ {
325
+ gmail_remove_dots : true ,
326
+ } ] ,
327
+ expect : {
328
+
329
+
330
+
266
331
} ,
267
332
} ) ;
268
333
334
+ // Testing *_remove_subaddress
269
335
test ( {
270
336
sanitizer : 'normalizeEmail' ,
271
- args : [ { remove_extension : false } ] ,
337
+ args : [ {
338
+ gmail_remove_subaddress : false ,
339
+ icloud_remove_subaddress : false ,
340
+ outlookdotcom_remove_subaddress : false ,
341
+ yahoo_remove_subaddress : false , // Note Yahoo uses "-"
342
+ } ] ,
272
343
expect : {
273
-
344
+
345
+ '[email protected] ' :
'[email protected] ' , // gmail_remove_subaddress
346
+ '[email protected] ' :
'[email protected] ' , // icloud_remove_subaddress
347
+ '[email protected] ' :
'[email protected] ' , // icloud_remove_subaddress
348
+ '[email protected] ' :
'[email protected] ' , // outlookdotcom_remove_subaddress
349
+ '[email protected] ' :
'[email protected] ' , // outlookdotcom_remove_subaddress
350
+ '[email protected] ' :
'[email protected] ' , // yahoo_remove_subaddress
351
+ '[email protected] ' :
'[email protected] ' , // yahoo_remove_subaddress
352
+ } ,
353
+ } ) ;
354
+
355
+ test ( {
356
+ sanitizer : 'normalizeEmail' ,
357
+ args : [ {
358
+ gmail_remove_subaddress : true ,
359
+ icloud_remove_subaddress : true ,
360
+ outlookdotcom_remove_subaddress : true ,
361
+ yahoo_remove_subaddress : true , // Note Yahoo uses "-"
362
+ } ] ,
363
+ expect : {
364
+
365
+ '[email protected] ' :
'[email protected] ' , // gmail_remove_subaddress
366
+ '[email protected] ' :
'[email protected] ' , // icloud_remove_subaddress
367
+ '[email protected] ' :
'[email protected] ' , // icloud_remove_subaddress
368
+ '[email protected] ' :
'[email protected] ' , // outlookdotcom_remove_subaddress
369
+ '[email protected] ' :
'[email protected] ' , // outlookdotcom_remove_subaddress
370
+ '[email protected] ' :
'[email protected] ' , // yahoo_remove_subaddress
371
+ '[email protected] ' :
'[email protected] ' , // yahoo_remove_subaddress
372
+ } ,
373
+ } ) ;
374
+
375
+ // Testing gmail_convert_googlemaildotcom
376
+ test ( {
377
+ sanitizer : 'normalizeEmail' ,
378
+ args : [ {
379
+ gmail_convert_googlemaildotcom : false ,
380
+ } ] ,
381
+ expect : {
382
+
383
+
384
+
385
+
386
+
387
+
388
+ } ,
389
+ } ) ;
390
+
391
+ test ( {
392
+ sanitizer : 'normalizeEmail' ,
393
+ args : [ {
394
+ gmail_convert_googlemaildotcom : true ,
395
+ } ] ,
396
+ expect : {
397
+
398
+
399
+
400
+
401
+
402
+
274
403
} ,
275
404
} ) ;
276
405
} ) ;
0 commit comments