Fix time unit full-field validation

This commit is contained in:
karilint
2026-05-28 15:55:24 +03:00
parent 94092424c3
commit 04a775b347
2 changed files with 11 additions and 4 deletions
@@ -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([