fix: simplifies block/array/hasMany-number field validations (#4052)
Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
This commit is contained in:
committed by
GitHub
parent
d308bb3421
commit
803a37eaa9
@@ -431,7 +431,7 @@ describe('Field Validations', () => {
|
||||
it('should handle required value', () => {
|
||||
const val = ''
|
||||
const result = number(val, { ...numberOptions, required: true })
|
||||
expect(result).toBe('validation:enterNumber')
|
||||
expect(result).toBe('validation:required')
|
||||
})
|
||||
it('should validate minValue', () => {
|
||||
const val = 2.4
|
||||
@@ -461,12 +461,12 @@ describe('Field Validations', () => {
|
||||
it('should validate an array of numbers using minRows', async () => {
|
||||
const val = [1.25, 2.5]
|
||||
const result = number(val, { ...numberOptions, hasMany: true, minRows: 4 })
|
||||
expect(result).toBe('validation:lessThanMin')
|
||||
expect(result).toBe('validation:requiresAtLeast')
|
||||
})
|
||||
it('should validate an array of numbers using maxRows', async () => {
|
||||
const val = [1.25, 2.5, 3.5]
|
||||
const result = number(val, { ...numberOptions, hasMany: true, maxRows: 2 })
|
||||
expect(result).toBe('validation:greaterThanMax')
|
||||
expect(result).toBe('validation:requiresNoMoreThan')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user