'Not able to test useEffect scenario in jest, enzyme or reast-testing-library

I am using jest & enzyme in React (TS), I tried my best with mocking the useEffect, mocking this function but this scenario is not getting green in coverage-report.

Is it not possible in jest & enzyme? Pls guide.

useEffect (() =>
props?.columnGroup?.originalColumnGroup?.addEventListener('expandedChanged', syncExpandedButtons);
syncExpandedButtons();
return () => {
props?.columnGroup?.originalColumnGroup?.addEventListener('expandedChanged', syncExpandedButtons);
}; }, []);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source