I need a fix for a validation that is always on when toggle switch is enabled

This validation works by inputting auto limits in a field. One requirement is to includeUmbrella with a BIPD limit. The other requirement is that each auto limit policyLimitUMBI and policyLimitUIMBI must be 500 to toggle the switch to includeUmbrella. The validation message is always on when the validation meets the requirements and if it does not meet. I open to any suggestions.

uninsuredMotoristLimit: Yup.string()
.test(
‘canHaveExcessUM’,
‘You must have 500K per occurrence of UM/UIM to add excess UM to umbrella’,
function (value, { options: { context } }) {
if (!value || value === ‘0’) {
return true;
}

          const {
            autoCoverage: { policyLimitUMBI, policyLimitUIMBI },
            state,
            includeUmbrella
          } = context;

          const canAddUM =
            canAddUmbrellaUMUIM({ policyLimitUMBI, policyLimitUIMBI, state }) && offerExcessUM[state];

          return includeUmbrella ? canAddUM : true;
        }
      )
      .nullable(),

I am expecting that when the requirements are not met then the validation message doesn’t appear.