@@ -363,7 +363,7 @@ describe('DatabaseController', function () {
363
363
} ) ;
364
364
} ) ;
365
365
366
- describe ( 'disableCollation ' , ( ) => {
366
+ describe ( 'enableCollationCaseComparison ' , ( ) => {
367
367
const dummyStorageAdapter = {
368
368
find : ( ) => Promise . resolve ( [ ] ) ,
369
369
watch : ( ) => Promise . resolve ( ) ,
@@ -374,69 +374,75 @@ describe('DatabaseController', function () {
374
374
Config . get ( Parse . applicationId ) . schemaCache . clear ( ) ;
375
375
} ) ;
376
376
377
- it ( 'should force caseInsensitive to false with disableCollation option' , async ( ) => {
377
+ it ( 'should force caseInsensitive to false with enableCollationCaseComparison option' , async ( ) => {
378
378
const databaseController = new DatabaseController ( dummyStorageAdapter , {
379
- disableCollation : true ,
379
+ enableCollationCaseComparison : true ,
380
380
} ) ;
381
381
const spy = spyOn ( dummyStorageAdapter , 'find' ) ;
382
382
spy . and . callThrough ( ) ;
383
383
await databaseController . find ( 'SomeClass' , { } , { caseInsensitive : true } ) ;
384
384
expect ( spy . calls . all ( ) [ 0 ] . args [ 3 ] . caseInsensitive ) . toEqual ( false ) ;
385
385
} ) ;
386
386
387
- it ( 'should support caseInsensitive without disableCollation option' , async ( ) => {
387
+ it ( 'should support caseInsensitive without enableCollationCaseComparison option' , async ( ) => {
388
388
const databaseController = new DatabaseController ( dummyStorageAdapter , { } ) ;
389
389
const spy = spyOn ( dummyStorageAdapter , 'find' ) ;
390
390
spy . and . callThrough ( ) ;
391
391
await databaseController . find ( '_User' , { } , { caseInsensitive : true } ) ;
392
392
expect ( spy . calls . all ( ) [ 0 ] . args [ 3 ] . caseInsensitive ) . toEqual ( true ) ;
393
393
} ) ;
394
394
395
- it_only_db ( 'mongo' ) ( 'should create insensitive indexes without disableCollation' , async ( ) => {
396
- await reconfigureServer ( {
397
- databaseURI : 'mongodb://localhost:27017/disableCollationFalse' ,
398
- databaseAdapter : undefined ,
399
- } ) ;
400
- const user = new Parse . User ( ) ;
401
- await user . save ( {
402
- username : 'example' ,
403
- password : 'password' ,
404
-
405
- } ) ;
406
- const schemas = await Parse . Schema . all ( ) ;
407
- const UserSchema = schemas . find ( ( { className } ) => className === '_User' ) ;
408
- expect ( UserSchema . indexes ) . toEqual ( {
409
- _id_ : { _id : 1 } ,
410
- username_1 : { username : 1 } ,
411
- case_insensitive_username : { username : 1 } ,
412
- case_insensitive_email : { email : 1 } ,
413
- email_1 : { email : 1 } ,
414
- } ) ;
415
- } ) ;
416
-
417
- it_only_db ( 'mongo' ) ( 'should not create insensitive indexes with disableCollation' , async ( ) => {
418
- await reconfigureServer ( {
419
- disableCollation : true ,
420
- databaseURI : 'mongodb://localhost:27017/disableCollationTrue' ,
421
- databaseAdapter : undefined ,
422
- } ) ;
423
- const user = new Parse . User ( ) ;
424
- await user . save ( {
425
- username : 'example' ,
426
- password : 'password' ,
427
-
428
- } ) ;
429
- const schemas = await Parse . Schema . all ( ) ;
430
- const UserSchema = schemas . find ( ( { className } ) => className === '_User' ) ;
431
- expect ( UserSchema . indexes ) . toEqual ( {
432
- _id_ : { _id : 1 } ,
433
- username_1 : { username : 1 } ,
434
- email_1 : { email : 1 } ,
435
- } ) ;
436
- } ) ;
395
+ it_only_db ( 'mongo' ) (
396
+ 'should create insensitive indexes without enableCollationCaseComparison' ,
397
+ async ( ) => {
398
+ await reconfigureServer ( {
399
+ databaseURI : 'mongodb://localhost:27017/enableCollationCaseComparisonFalse' ,
400
+ databaseAdapter : undefined ,
401
+ } ) ;
402
+ const user = new Parse . User ( ) ;
403
+ await user . save ( {
404
+ username : 'example' ,
405
+ password : 'password' ,
406
+
407
+ } ) ;
408
+ const schemas = await Parse . Schema . all ( ) ;
409
+ const UserSchema = schemas . find ( ( { className } ) => className === '_User' ) ;
410
+ expect ( UserSchema . indexes ) . toEqual ( {
411
+ _id_ : { _id : 1 } ,
412
+ username_1 : { username : 1 } ,
413
+ case_insensitive_username : { username : 1 } ,
414
+ case_insensitive_email : { email : 1 } ,
415
+ email_1 : { email : 1 } ,
416
+ } ) ;
417
+ }
418
+ ) ;
419
+
420
+ it_only_db ( 'mongo' ) (
421
+ 'should not create insensitive indexes with enableCollationCaseComparison' ,
422
+ async ( ) => {
423
+ await reconfigureServer ( {
424
+ enableCollationCaseComparison : true ,
425
+ databaseURI : 'mongodb://localhost:27017/enableCollationCaseComparisonTrue' ,
426
+ databaseAdapter : undefined ,
427
+ } ) ;
428
+ const user = new Parse . User ( ) ;
429
+ await user . save ( {
430
+ username : 'example' ,
431
+ password : 'password' ,
432
+
433
+ } ) ;
434
+ const schemas = await Parse . Schema . all ( ) ;
435
+ const UserSchema = schemas . find ( ( { className } ) => className === '_User' ) ;
436
+ expect ( UserSchema . indexes ) . toEqual ( {
437
+ _id_ : { _id : 1 } ,
438
+ username_1 : { username : 1 } ,
439
+ email_1 : { email : 1 } ,
440
+ } ) ;
441
+ }
442
+ ) ;
437
443
} ) ;
438
444
439
- describe ( 'transformEmailToLowerCase ' , ( ) => {
445
+ describe ( 'convertEmailToLowercase ' , ( ) => {
440
446
const dummyStorageAdapter = {
441
447
createObject : ( ) => Promise . resolve ( { ops : [ { } ] } ) ,
442
448
findOneAndUpdate : ( ) => Promise . resolve ( { } ) ,
@@ -456,7 +462,7 @@ describe('DatabaseController', function () {
456
462
updatedAt : { iso : undefined , __type : 'Date' } ,
457
463
} ;
458
464
459
- it ( 'should not transform email to lower case without transformEmailToLowerCase option on create' , async ( ) => {
465
+ it ( 'should not transform email to lower case without convertEmailToLowercase option on create' , async ( ) => {
460
466
const databaseController = new DatabaseController ( dummyStorageAdapter , { } ) ;
461
467
const spy = spyOn ( dummyStorageAdapter , 'createObject' ) ;
462
468
spy . and . callThrough ( ) ;
@@ -469,9 +475,9 @@ describe('DatabaseController', function () {
469
475
} ) ;
470
476
} ) ;
471
477
472
- it ( 'should transform email to lower case with transformEmailToLowerCase option on create' , async ( ) => {
478
+ it ( 'should transform email to lower case with convertEmailToLowercase option on create' , async ( ) => {
473
479
const databaseController = new DatabaseController ( dummyStorageAdapter , {
474
- transformEmailToLowerCase : true ,
480
+ convertEmailToLowercase : true ,
475
481
} ) ;
476
482
const spy = spyOn ( dummyStorageAdapter , 'createObject' ) ;
477
483
spy . and . callThrough ( ) ;
@@ -484,7 +490,7 @@ describe('DatabaseController', function () {
484
490
} ) ;
485
491
} ) ;
486
492
487
- it ( 'should not transform email to lower case without transformEmailToLowerCase option on update' , async ( ) => {
493
+ it ( 'should not transform email to lower case without convertEmailToLowercase option on update' , async ( ) => {
488
494
const databaseController = new DatabaseController ( dummyStorageAdapter , { } ) ;
489
495
const spy = spyOn ( dummyStorageAdapter , 'findOneAndUpdate' ) ;
490
496
spy . and . callThrough ( ) ;
@@ -494,9 +500,9 @@ describe('DatabaseController', function () {
494
500
} ) ;
495
501
} ) ;
496
502
497
- it ( 'should transform email to lower case with transformEmailToLowerCase option on update' , async ( ) => {
503
+ it ( 'should transform email to lower case with convertEmailToLowercase option on update' , async ( ) => {
498
504
const databaseController = new DatabaseController ( dummyStorageAdapter , {
499
- transformEmailToLowerCase : true ,
505
+ convertEmailToLowercase : true ,
500
506
} ) ;
501
507
const spy = spyOn ( dummyStorageAdapter , 'findOneAndUpdate' ) ;
502
508
spy . and . callThrough ( ) ;
@@ -506,8 +512,8 @@ describe('DatabaseController', function () {
506
512
} ) ;
507
513
} ) ;
508
514
509
- it ( 'should not find a case insensitive user by email with transformEmailToLowerCase ' , async ( ) => {
510
- await reconfigureServer ( { transformEmailToLowerCase : true } ) ;
515
+ it ( 'should not find a case insensitive user by email with convertEmailToLowercase ' , async ( ) => {
516
+ await reconfigureServer ( { convertEmailToLowercase : true } ) ;
511
517
const user = new Parse . User ( ) ;
512
518
await user . save ( { email :
'[email protected] ' , password :
'password' } ) ;
513
519
@@ -523,7 +529,7 @@ describe('DatabaseController', function () {
523
529
} ) ;
524
530
} ) ;
525
531
526
- describe ( 'transformUsernameToLowerCase ' , ( ) => {
532
+ describe ( 'convertUsernameToLowercase ' , ( ) => {
527
533
const dummyStorageAdapter = {
528
534
createObject : ( ) => Promise . resolve ( { ops : [ { } ] } ) ,
529
535
findOneAndUpdate : ( ) => Promise . resolve ( { } ) ,
@@ -543,7 +549,7 @@ describe('DatabaseController', function () {
543
549
updatedAt : { iso : undefined , __type : 'Date' } ,
544
550
} ;
545
551
546
- it ( 'should not transform username to lower case without transformUsernameToLowerCase option on create' , async ( ) => {
552
+ it ( 'should not transform username to lower case without convertUsernameToLowercase option on create' , async ( ) => {
547
553
const databaseController = new DatabaseController ( dummyStorageAdapter , { } ) ;
548
554
const spy = spyOn ( dummyStorageAdapter , 'createObject' ) ;
549
555
spy . and . callThrough ( ) ;
@@ -556,9 +562,9 @@ describe('DatabaseController', function () {
556
562
} ) ;
557
563
} ) ;
558
564
559
- it ( 'should transform username to lower case with transformUsernameToLowerCase option on create' , async ( ) => {
565
+ it ( 'should transform username to lower case with convertUsernameToLowercase option on create' , async ( ) => {
560
566
const databaseController = new DatabaseController ( dummyStorageAdapter , {
561
- transformUsernameToLowerCase : true ,
567
+ convertUsernameToLowercase : true ,
562
568
} ) ;
563
569
const spy = spyOn ( dummyStorageAdapter , 'createObject' ) ;
564
570
spy . and . callThrough ( ) ;
@@ -571,7 +577,7 @@ describe('DatabaseController', function () {
571
577
} ) ;
572
578
} ) ;
573
579
574
- it ( 'should not transform username to lower case without transformUsernameToLowerCase option on update' , async ( ) => {
580
+ it ( 'should not transform username to lower case without convertUsernameToLowercase option on update' , async ( ) => {
575
581
const databaseController = new DatabaseController ( dummyStorageAdapter , { } ) ;
576
582
const spy = spyOn ( dummyStorageAdapter , 'findOneAndUpdate' ) ;
577
583
spy . and . callThrough ( ) ;
@@ -581,9 +587,9 @@ describe('DatabaseController', function () {
581
587
} ) ;
582
588
} ) ;
583
589
584
- it ( 'should transform username to lower case with transformUsernameToLowerCase option on update' , async ( ) => {
590
+ it ( 'should transform username to lower case with convertUsernameToLowercase option on update' , async ( ) => {
585
591
const databaseController = new DatabaseController ( dummyStorageAdapter , {
586
- transformUsernameToLowerCase : true ,
592
+ convertUsernameToLowercase : true ,
587
593
} ) ;
588
594
const spy = spyOn ( dummyStorageAdapter , 'findOneAndUpdate' ) ;
589
595
spy . and . callThrough ( ) ;
@@ -593,8 +599,8 @@ describe('DatabaseController', function () {
593
599
} ) ;
594
600
} ) ;
595
601
596
- it ( 'should not find a case insensitive user by username with transformUsernameToLowerCase ' , async ( ) => {
597
- await reconfigureServer ( { transformUsernameToLowerCase : true } ) ;
602
+ it ( 'should not find a case insensitive user by username with convertUsernameToLowercase ' , async ( ) => {
603
+ await reconfigureServer ( { convertUsernameToLowercase : true } ) ;
598
604
const user = new Parse . User ( ) ;
599
605
await user . save ( { username : 'EXAMPLE' , password : 'password' } ) ;
600
606
0 commit comments