src/models/sections/financialNonPayment.js

Summary

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

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

export default nonpaymentModel