3 Minutes with Kent

React Testing Patterns


Listen Later

I had a friend send me this testing code:

describe('handleChangeStatusConditionSearchText', () => {
test('should handle changing status search text within FormWizard', () =>
{
const wrapper = shallow();
const state = {
...wrapper.instance().state,
statusConditionSearchText: 'poop'
};
wrapper.instance().handleChangeStatusConditionSearchText('poop');
expect(wrapper.instance().state).toEqual(state);
});
});

And I had a few concerns with it, so I decided to record my thoughts :)

(Learn more about enzyme and shallow
rendering, and then never shallow render again... 😉)

...more
View all episodesView all episodes
Download on the App Store

3 Minutes with KentBy Kent C. Dodds

  • 5
  • 5
  • 5
  • 5
  • 5

5

4 ratings