title: Test React Reducer using Jest Enzyme
body: <p>I have a reducer like this in my react app.  I have a reducer like this in my react app.  I have a reducer like this in my react app.  I have a reducer like this in my react app.  I have a reducer like this in my react app.  I have a reducer like this in my react app.  I have a reducer like this in my react app.  I have a reducer like this in my react app.  I have a reducer like this in my react app.</p>
  <p>reducer.ts</p>
  <pre><code>import React, { useEffect } from 'react'
  import PropTypes from 'prop-types'
  
  import FormField from 'wf-dbd-react-ui/es/FormField'
  import FormFieldLabel from 'wf-dbd-react-ui/es/FormFieldLabel'
  import FormFieldErrors from 'wf-dbd-react-ui/es/FormFieldErrors'
  import Translatable from 'wf-dbd-react-ui/es/Translatable'
  import Block from 'wf-dbd-react-ui/es/Block'
  import withStrings from 'wf-dbd-react-ui/es/withStrings'
  
  import { getMemoLabel } from '../../../../lib/utils/manage-payee-util'
  import FormInput from 'wf-dbd-react-ui/es/FormInput'
  import withMemoValidation from './withMemoValidation'
  import ArialiveMemo from './ArialiveMemo'
  import styles from './Memo.less'
  import FormFieldErrorIcon from 'wf-dbd-react-ui/es/FormFieldErrorIcon'
  import { MEMO_MAX_CHARS } from '../../../../components/workflows/edit-payment/constants'
  
  const Memo = ({
    fieldId,
    defaultMemo,
    memo,
    isConfirm,
    getString,
    validateMemoField,
    userTypedMemo,
    isMemoFieldError,
    memoFieldValidate,
    defaultMemoValidate
  }) =&gt; {
    useEffect(() =&gt; {
      memoFieldValidate(userTypedMemo &lt;= MEMO_MAX_CHARS)
    }, [userTypedMemo, memoFieldValidate] )
  
    useEffect(() =&gt; {
      defaultMemoValidate(defaultMemo &amp;&amp; defaultMemo.length &lt;= MEMO_MAX_CHARS)
    }, [defaultMemo, defaultMemoValidate] )
  
  
    const memoLabel = getMemoLabel()
    return !isConfirm ? (
      &lt;Block className={styles.memo}&gt;
        &lt;FormField fieldId={fieldId}&gt;
          &lt;FormFieldLabel&gt;
            { isMemoFieldError &amp;&amp;
            &lt;FormFieldErrorIcon className={styles.errorIcon} /&gt;
            }
            &lt;div className={isMemoFieldError ? styles.errorMemoLabel : styles.memoLabel}&gt;
              &lt;Translatable id={memoLabel} /&gt;
            &lt;/div&gt;
          &lt;/FormFieldLabel&gt;
          &lt;FormInput
            className={isMemoFieldError ? styles.inputerror : styles.input}
            initialValue={defaultMemo}
            onChange={validateMemoField}
            type=&quot;text&quot;
            maxLength={MEMO_MAX_CHARS}
            placeholder={getString('memoPlaceholder')}
            deleteOnUnmount={true}
          /&gt;
          &lt;FormFieldErrors /&gt;
          {userTypedMemo &amp;&amp; &lt;ArialiveMemo count={userTypedMemo} /&gt;}
        &lt;/FormField&gt;
      &lt;/Block&gt;
    ) : (
      &lt;React.Fragment&gt;
        &lt;Translatable id={memoLabel} /&gt;
        &lt;Block&gt;
          &lt;strong className={memo.length &gt; MEMO_MAX_CHARS ? styles.inputerror : ''}&gt;
            {memo}
          &lt;/strong&gt;
        &lt;/Block&gt;
      &lt;/React.Fragment&gt;
    )
  }
  
  Memo.defaultProps = {
    isConfirm: false
  }
  
  Memo.propTypes = {
    fieldId: PropTypes.string,
    defaultMemo: PropTypes.string,
    isConfirm: PropTypes.bool,
    memo: PropTypes.string,
    validateMemoField: PropTypes.func,
    userTypedMemo: PropTypes.number,
    isMemoFieldError: PropTypes.bool,
    memoFieldValidate: PropTypes.func,
    defaultMemoValidate: PropTypes.func
  }
  
  export default withMemoValidation(withStrings(Memo))
  
  </code></pre>
  <p>However, when i run <code>test-cov</code>, it says that Line 2, 3 and 8 are not covered. How do i cover the if else condition in the reducer file.</p>