mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Fix time unit full-field validation
This commit is contained in:
@@ -14,7 +14,6 @@ const createTimeUnitValidators = (
|
||||
},
|
||||
up_bnd: {
|
||||
name: 'New Upper Bound',
|
||||
required: true,
|
||||
asNumber: (num: number) => {
|
||||
if (num === editData.low_bnd) return 'Upper and lower bounds cannot be the same'
|
||||
return
|
||||
@@ -22,7 +21,6 @@ const createTimeUnitValidators = (
|
||||
},
|
||||
low_bnd: {
|
||||
name: 'New Lower Bound',
|
||||
required: true,
|
||||
asNumber: (num: number) => {
|
||||
if (num === editData.up_bnd) return 'Upper and lower bounds cannot be the same'
|
||||
return
|
||||
|
||||
@@ -58,14 +58,23 @@ describe('entity full-field validators', () => {
|
||||
expect.arrayContaining([
|
||||
{ name: 'Name', error: 'This field is required' },
|
||||
{ name: 'Sequence', error: 'This field is required' },
|
||||
{ name: 'New Upper Bound', error: 'This field is required' },
|
||||
{ name: 'New Lower Bound', error: 'This field is required' },
|
||||
{ name: 'Upper Bound', error: 'This field is required' },
|
||||
{ name: 'Lower Bound', error: 'This field is required' },
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
it('does not require Time Unit helper bound ids when resolved bounds exist', () => {
|
||||
const errors = validateTimeUnitFields({
|
||||
tu_display_name: 'Test time unit',
|
||||
sequence: 'ALMA',
|
||||
up_bound: { bid: 11, b_name: 'C2N-y', age: 4.37, b_comment: '' },
|
||||
low_bound: { bid: 14, b_name: 'C2N-o', age: 4.631, b_comment: '' },
|
||||
})
|
||||
|
||||
expect(errors).toEqual([])
|
||||
})
|
||||
|
||||
it('reports missing simple entity required fields', () => {
|
||||
expect(validatePersonFields({})).toEqual(
|
||||
expect.arrayContaining([
|
||||
|
||||
Reference in New Issue
Block a user