Skip to content

Instantly share code, notes, and snippets.

@atmd83
Created February 27, 2018 13:02
Show Gist options
  • Save atmd83/3de76a24e062271497dae1e43b05282d to your computer and use it in GitHub Desktop.
Save atmd83/3de76a24e062271497dae1e43b05282d to your computer and use it in GitHub Desktop.
medium failed test
describe('when the state changes', () => {
it('it renders correctly', () => {
component = shallow(<Thing value={3} />);
expect(component.find('h1').text()).toEqual('The value is 3');
// lets alter the state
component.setState({ message: 'You have a value of' });
// remember our shouldComponentUpdate() rejects any update
// unless the prop value has changed
expect(component.find('h1').text()).toEqual('The value is 3');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment