I have a react class, which has the addEventListener in componentDidMount as below:
componentDidMount() {
document.addEventListener('readystatechange', () => {
if (document.readyState === 'complete'){
/* Make some api call */
/*Need to test code written here*/
}
});
}
The readystatechange event triggers on change of 'document.readyState' and document.readystate is read-only, how can I simulate this call?