Skip to content

Commit 482d398

Browse files
remove dead code
1 parent d3b0eec commit 482d398

File tree

3 files changed

+0
-58
lines changed

3 files changed

+0
-58
lines changed

src/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ function validSchema(k, v, obj, ref, version, kind) {
8888
'expression',
8989
'property-type',
9090
'length',
91-
'min-length',
9291
'required',
9392
'transition',
9493
'type',

src/validate/validate_array.test.ts

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

src/validate/validate_array.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ export function validateArray(options) {
1818
return [new ValidationError(key, array, `array length ${arraySpec.length} expected, length ${array.length} found`)];
1919
}
2020

21-
if (arraySpec['min-length'] && array.length < arraySpec['min-length']) {
22-
return [new ValidationError(key, array, `array length at least ${arraySpec['min-length']} expected, length ${array.length} found`)];
23-
}
24-
2521
let arrayElementSpec = {
2622
'type': arraySpec.value,
2723
'values': arraySpec.values

0 commit comments

Comments
 (0)