Checking props of a child component with shallow rendering using enzyme
Calling wrapper.update()
after selectCity()
should do the trick:
it("updates the temperature when the city is changed", () => { var wrapper = shallow(<WeatherApplication/>); wrapper.instance().selectCity("Bremen"); wrapper.update(); var citySelection = wrapper.find(CitySelection); expect(citySelection.props().selectedCity).toEqual("Bremen"); });