import React from 'react'; import { mount } from 'enzyme'; import Modal from '..'; jest.mock('rc-util/lib/Portal'); class ModalTester extends React.Component { constructor(props) { super(props); this.state = { visible: false }; } componentDidMount() { this.setState({ visible: true }); // eslint-disable-line react/no-did-mount-set-state } saveContainer = (container) => { this.container = container; } getContainer = () => { return this.container; } render() { return (
Here is content of Modal
); } } describe('Modal', () => { it('render correctly', () => { const wrapper = mount(); expect(wrapper.render()).toMatchSnapshot(); }); it('render without footer', () => { const wrapper = mount(); expect(wrapper.render()).toMatchSnapshot(); }); });