@@ -399,7 +399,7 @@ describe('ValidationsDispatcher', () => {
399
399
} ) ;
400
400
} ) ;
401
401
402
- it ( 'Spec #11 => should return empty FieldValidationResult and calls to validation functions ' +
402
+ it ( 'Spec #12 => should return empty FieldValidationResult and calls to validation functions ' +
403
403
'When passing vm equals undefined, value equals undefined and validationsPerField equals array with one item ' +
404
404
'equals validation function resolving a fieldValidationResult equals ""' , ( done ) => {
405
405
//Arrange
@@ -433,7 +433,7 @@ describe('ValidationsDispatcher', () => {
433
433
} ) ;
434
434
} ) ;
435
435
436
- it ( 'Spec #12 => should return undefined FieldValidationResult and calls to first validation function ' +
436
+ it ( 'Spec #13 => should return undefined FieldValidationResult and calls to first validation function ' +
437
437
'When passing vm equals undefined, value equals undefined and validationsPerField equals array with two items ' +
438
438
'first equals validation function resolving a fieldValidationResult equals undefined' +
439
439
'second equals successful validation function' , ( done ) => {
@@ -484,7 +484,7 @@ describe('ValidationsDispatcher', () => {
484
484
} ) ;
485
485
} ) ;
486
486
487
- it ( 'Spec #13 => should return undefined FieldValidationResult and calls to first validation function ' +
487
+ it ( 'Spec #14 => should return undefined FieldValidationResult and calls to first validation function ' +
488
488
'When passing vm equals undefined, value equals undefined and validationsPerField equals array with two items ' +
489
489
'first equals validation function resolving a fieldValidationResult equals undefined' +
490
490
'second equals failed validation function' , ( done ) => {
@@ -534,7 +534,7 @@ describe('ValidationsDispatcher', () => {
534
534
} ) ;
535
535
} ) ;
536
536
537
- it ( 'Spec #14 => should return failed and key equals "test1" FieldValidationResult and calls to first validation function ' +
537
+ it ( 'Spec #15 => should return failed and key equals "test1" FieldValidationResult and calls to first validation function ' +
538
538
'When passing vm equals undefined, value equals undefined and validationsPerField equals array with two items ' +
539
539
'first equals failed validation function' +
540
540
'second equals validation function resolving a fieldValidationResult equals undefined' , ( done ) => {
@@ -586,7 +586,7 @@ describe('ValidationsDispatcher', () => {
586
586
} ) ;
587
587
} ) ;
588
588
589
- it ( 'Spec #15 => should return undefined FieldValidationResult and calls to first and second validation functions ' +
589
+ it ( 'Spec #16 => should return undefined FieldValidationResult and calls to first and second validation functions ' +
590
590
'When passing vm equals undefined, value equals undefined and validationsPerField equals array with two items ' +
591
591
'first equals successful validation function' +
592
592
'second equals validation function resolving a fieldValidationResult equals undefined' , ( done ) => {
@@ -636,7 +636,7 @@ describe('ValidationsDispatcher', () => {
636
636
} ) ;
637
637
} ) ;
638
638
639
- it ( 'should pass customParams to its proper validationFunction' , ( done ) => {
639
+ it ( 'Spec #17 => should pass customParams to its proper validationFunction' , ( done ) => {
640
640
//Arrange
641
641
const vm = undefined ;
642
642
const value = undefined ;
@@ -800,7 +800,7 @@ describe('ValidationsDispatcher', () => {
800
800
} ) ;
801
801
802
802
it ( 'Spec #9 => should return empty array and should not call to validationFn ' +
803
- 'when passing vm equals { }, vmKeys as non empty array and validationFn equals function' , ( ) => {
803
+ 'when passing vm equals { testVmProperty: "" }, vmKeys equals ["otherProperty"] and validationFn equals function' , ( ) => {
804
804
//Arrange
805
805
const vm = {
806
806
testVmProperty : ''
@@ -816,8 +816,8 @@ describe('ValidationsDispatcher', () => {
816
816
expect ( validationFnSpy . called ) . to . be . false ;
817
817
} ) ;
818
818
819
- it ( 'Spec #10 => should not return empty array with one item and it calls to validationFn ' +
820
- 'when passing vm equals { testVmProperty: "test" }, vmKeys equals [] and validationFn equals function' , ( ) => {
819
+ it ( 'Spec #10 => should return array with one item and it calls to validationFn ' +
820
+ 'when passing vm equals { testVmProperty: "test" }, vmKeys equals [testVmProperty ] and validationFn equals function' , ( ) => {
821
821
//Arrange
822
822
const vm = {
823
823
testVmProperty : 'test'
@@ -828,6 +828,25 @@ describe('ValidationsDispatcher', () => {
828
828
//Act
829
829
const fieldValidationResultPromises = validationsDispatcher . fireAllFieldsValidations ( vm , vmKeys , validationFnSpy ) ;
830
830
831
+ //Ass
832
+ expect ( fieldValidationResultPromises ) . to . have . length ( 1 ) ;
833
+ expect ( validationFnSpy . called ) . to . be . true ;
834
+ } ) ;
835
+
836
+ it ( 'Spec #11 => should return array with one item and it calls to validationFn ' +
837
+ 'when passing vm equals { test: { property: "test"} }, vmKeys equals ["test.property"] and validationFn equals function' , ( ) => {
838
+ //Arrange
839
+ const vm = {
840
+ test : {
841
+ property : 'test' ,
842
+ } ,
843
+ } ;
844
+ const vmKeys = [ 'test.property' ] ;
845
+ const validationFnSpy = sinon . spy ( ) ;
846
+
847
+ //Act
848
+ const fieldValidationResultPromises = validationsDispatcher . fireAllFieldsValidations ( vm , vmKeys , validationFnSpy ) ;
849
+
831
850
//Ass
832
851
expect ( fieldValidationResultPromises ) . to . have . length ( 1 ) ;
833
852
expect ( validationFnSpy . called ) . to . be . true ;
@@ -957,7 +976,7 @@ describe('ValidationsDispatcher', () => {
957
976
it ( 'Spec #9 => should return array with one item and it calls to validationFn' +
958
977
'When passing vm equals function, validations equals array with one validationFn' , ( ) => {
959
978
//Arrange
960
- const vm = function ( ) {
979
+ const vm = function ( ) {
961
980
return "this is a function" ;
962
981
} ;
963
982
const validationFnSpy = sinon . spy ( ) ;
0 commit comments