Simulate img.onError using jest/enzyme

Viewed 45

I Have an image in a component that triggers an onerror func when the img1 wont load, my question is how can i test this onError using jest/enzyme?

       <img
           alt={institute}
           src={img1}
           onError={e => {
                      e.target.onError = null
                      e.target.src = defaultImg
                         }}
          className={img1}
      />
0 Answers
Related