@@ -68,28 +68,6 @@ describe('Validate Array', () => {
6868 expect ( errors [ 0 ] . message ) . toBe ( 'testArray: array length 2 expected, length 3 found' ) ;
6969 } ) ;
7070
71- test ( 'Should return error if array length is less than min-length' , ( ) => {
72- let errors = validateArray ( {
73- validateSpec : validate ,
74- key : 'testArray' ,
75- value : [ 1 , 2 ] ,
76- valueSpec : { type : 'array' , value : 'number' , 'min-length' : 3 } ,
77- styleSpec : v8
78- } ) ;
79- expect ( errors ) . toHaveLength ( 1 ) ;
80- expect ( errors [ 0 ] . message ) . toBe ( 'testArray: array length at least 3 expected, length 2 found' ) ;
81-
82- errors = validateArray ( {
83- validateSpec : validate ,
84- key : 'testArray' ,
85- value : [ ] ,
86- valueSpec : { type : 'array' , value : 'number' , 'min-length' : 1 } ,
87- styleSpec : v8
88- } ) ;
89- expect ( errors ) . toHaveLength ( 1 ) ;
90- expect ( errors [ 0 ] . message ) . toBe ( 'testArray: array length at least 1 expected, length 0 found' ) ;
91- } ) ;
92-
9371 test ( 'Should pass if array length matches spec' , ( ) => {
9472 const errors = validateArray ( {
9573 validateSpec : validate ,
@@ -101,26 +79,6 @@ describe('Validate Array', () => {
10179 expect ( errors ) . toHaveLength ( 0 ) ;
10280 } ) ;
10381
104- test ( 'Should pass if array length meets min-length' , ( ) => {
105- let errors = validateArray ( {
106- validateSpec : validate ,
107- key : 'testArray' ,
108- value : [ 1 , 2 , 3 ] ,
109- valueSpec : { type : 'array' , value : 'number' , 'min-length' : 2 } ,
110- styleSpec : v8
111- } ) ;
112- expect ( errors ) . toHaveLength ( 0 ) ;
113-
114- errors = validateArray ( {
115- validateSpec : validate ,
116- key : 'testArray' ,
117- value : [ 1 , 2 ] ,
118- valueSpec : { type : 'array' , value : 'number' , 'min-length' : 2 } ,
119- styleSpec : v8
120- } ) ;
121- expect ( errors ) . toHaveLength ( 0 ) ;
122- } ) ;
123-
12482 test ( 'Should return error if array contains invalid element types' , ( ) => {
12583 let errors = validateArray ( {
12684 validateSpec : validate ,
@@ -183,17 +141,6 @@ describe('Validate Array', () => {
183141 expect ( errors ) . toHaveLength ( 0 ) ;
184142 } ) ;
185143
186- test ( 'Should pass for empty array when no min-length is specified' , ( ) => {
187- const errors = validateArray ( {
188- validateSpec : validate ,
189- key : 'testArray' ,
190- value : [ ] ,
191- valueSpec : { type : 'array' , value : 'number' } ,
192- styleSpec : v8
193- } ) ;
194- expect ( errors ) . toHaveLength ( 0 ) ;
195- } ) ;
196-
197144 test ( 'Should validate arrays with complex element specs' , ( ) => {
198145 const errors = validateArray ( {
199146 validateSpec : validate ,
0 commit comments