Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyComponent extends React.Component {
- constructor(props) {
- super(props)
- if (props.invalid) {
- throw new Error('invalid')
- }
- }
- }
- const wrapper = shallow(
- <MyComponent invalid />
- )
- it('should throw', () => {
- function fn() {
- if (wrapper.instance().props.invalid) {
- throw new Error('invalid')
- }
- }
- expect(fn).toThrow()
- })
Add Comment
Please, Sign In to add comment