Guest User

Untitled

a guest
Mar 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class MyComponent extends React.Component {
  2. constructor(props) {
  3. super(props)
  4. if (props.invalid) {
  5. throw new Error('invalid')
  6. }
  7. }
  8. }
  9.  
  10. const wrapper = shallow(
  11. <MyComponent invalid />
  12. )
  13.  
  14. it('should throw', () => {
  15. function fn() {
  16. if (wrapper.instance().props.invalid) {
  17. throw new Error('invalid')
  18. }
  19. }
  20. expect(fn).toThrow()
  21. })
Add Comment
Please, Sign In to add comment