test props jest code example
Example 1: how to pass props in react test cases
it('renders results after search', () => {
const fetched = true;
const wrapper = mount(<Search store={store} {...fetched}/>);
expect(wrapper.find('Results').length).toEqual(1);
});
Example 2: enzye check if it renders
describe('when x', () => {
it('check if child renders', () => {
const wrapper = shallow(<Parent />);
expect(wrapper.find(ChildComponentName).length).toEqual(1);
});
});