should skip a POF without an obsField definition

This commit is contained in:
Johannes Klein
2026-07-14 15:29:19 +02:00
parent f2c8968edd
commit 40f2e11afc

View File

@@ -516,6 +516,20 @@ describe( "validateProjectFieldsForObservation", () => {
validateProjectFieldsForObservation( mockObservation, [mockProject] ).valid,
).toBe( true );
} );
it( "should skip a POF without an obsField definition", () => {
const mockProject = {
projectObservationFields: [{
required: true,
obsField: undefined,
}],
};
const mockObservation = { observationFieldValues: [] };
expect(
validateProjectFieldsForObservation( mockObservation, [mockProject] ).valid,
).toBe( true );
} );
it( "should return MISSING_REQUIRED when observationFieldValues is undefined", () => {
const mockProject = {
projectObservationFields: [{