Created
February 27, 2018 12:48
-
-
Save atmd83/21dde9ef0932a262763b6ff40397ed4f to your computer and use it in GitHub Desktop.
medium post updated describe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('when the props change', () => { | |
it('will publish the correct messages based on the prop', () => { | |
// lets give the component a 'value' prop | |
component = shallow(<Thing value={3} />); | |
// lets update the component with the same prop | |
component.setProps({ value: 3 }); | |
expect(PubSub.publish).lastCalledWith('thing.will.receive.props'); | |
// shouldComponentUpdate will return false | |
// so componentWillUpdate() will not call | |
expect(PubSub.publish).not.toHaveBeenCalledWith('thing.should.update'); | |
expect(PubSub.publish).not.toHaveBeenCalledWith('thing.will.update'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment