src/models/sections/legalDomesticViolence.js

Summary

Maintainability
A
0 mins
Test Coverage
import { hasYesOrNo } from 'models/validate'
import domesticViolence from 'models/domesticViolence'

const domesticViolenceModel = {
  HasDomesticViolence: { presence: true, hasValue: { validator: hasYesOrNo } },
  List: (value, attributes) => {
    if (attributes.HasDomesticViolence && attributes.HasDomesticViolence.value === 'Yes') {
      return {
        presence: true,
        accordion: { validator: domesticViolence },
      }
    }

    return {}
  },
}

export default domesticViolenceModel