Nov 17, 2017
Test ajax calls in react component lifecycle
While developing React application you will most likely need to fetch some data from API. If you're using class components a common place to do this is componentDidMount lifecycle method. But then you might be wondering how to properly write unit tests for it? In this blog post I will show basic examples how to write tests for HTTP calls inside class methods.