it('returns result of success prop if no errors, loading status', () => { const props = { query: { key: 'val' }, errorCheck: () => false, success: () => 'success result thing' } wrapper = shallow(<ConnectedComponent {...props} />) childFunc = wrapper.find(Query).first().prop('children') expect(childFunc({ loading: false, error: false, data: 'blah' })).toEqual(props.success()) })
it('renders Error component if errorCheck prop evalutes to true', () => { const props = { query: { key: 'val' }, errorCheck: () => true } wrapper = shallow(<ConnectedComponent {...props} />) childFunc = wrapper.find(Query).first().prop('children') expect(childFunc({ loading: false, error: false })).toEqual(<Error />) })