score:1
it('renders results after search', () => {
const fetched = true;
const wrapper = shallow(<Search store={store} fetched={fetched} />);
expect(wrapper.find('Results').length).toEqual(1);
});
then you can do the same thing either omitting fetched or setting to false
score:1
it('renders results after search', () => {
const fetched = true;
const wrapper = mount(<Search store={store} {...fetched}/>);
expect(wrapper.find('Results').length).toEqual(1);
});
Use mount
instead of shallow
that should fix your problem. or you can alternatively try with wrapper.update()
keeping the shallow
(I'm not sure about this).
Source: stackoverflow.com
Related Query
- How to pass props into jest test in React
- how to test props which is pass through Link in react router with React-testing-library or jest
- How to test default props functions is attached to component or not ? | React | Jest | Enzyme
- how to pass props into component from route array in react
- How to pass React props into a p5.js sketch
- How do I pass Meteor Subscription Data into React Component Props using ES6
- How to Pass A Custom Interface As Props Into A Functional React Component
- React JS - How to pass different props into a map of other props
- how do I pass additional props into a react component through a higher order function
- How to properly pass event handlers as props into typescript react component?
- How to pass in a react component into another react component to transclude the first component's content?
- How to test a className with the Jest and React testing library
- How to pass all other props to react class?
- React - How to pass props to a component passed as prop
- How to pass several props in spread operator in react
- How to verify React props in Jest and Enzyme?
- How to write test case for ErrorBoundary in React using Jest / Enzyme
- How to "mock" navigator.geolocation in a React Jest Test
- How to pass props to component inside a React Navigation navigator?
- How to pass params into link using React router v6?
- How to unit test a react event handler that contains history.push using Jest and Enzyme?
- React useReducer Hook fires twice / how to pass props to reducer?
- How to mock functions, and test that they're called, when passed as props in react components?
- How to test form submission in React with Jest and Enzyme? Cannot read property 'preventDefault' of undefined
- How to test snapshots with Jest and new React lazy 16.6 API
- How to check props of a DOM node in an unit test in React 0.14?
- Jest and React Testing Library, how to test if an element is hidden?
- How do I pass an object containing props to React component?
- How can I test React component's style with Jest + Enzyme?
- How to test the state of a functional component in React with Jest (No Enzyme)
More Query from same tag
- How to open an <input type="file"/> with a button click in React
- Objects are not valid as a React child (found: object with keys {arr}). If you meant to render a collection of children, use an array instead
- How to create multiple object in Reactjs?
- React Typescript OnClick with optional parameters
- How to avoid 404 error when reload a page in react?
- How to access the actual react rendered DOM in another application?
- what is the difference between createStore and createStoreWithMiddleware in react?
- Show all result from a list if all value is selected
- How to send multiple files to controller of ASP.NET Core using Axios?
- Adding a className dynamically in React.js with Tailwind.css
- How do I create configuration for axios for default request headers in every http call?
- Autocomplete value are not being set on the state or maybe just on the autocomplete
- How to merge different node modules and make different bundles from them?
- Not able to download PDF in safari browser on iphone or ipad pro ios12
- Uncaught TypeError: Cannot read properties of undefined (reading 'roll')
- How can I use CSS Pseudo-elements styling inside React JSX to pass variables?
- Migration of code from AngularJS to ReactJS
- compare two arrays of Objects in JavaScript and if true save new items to MongoDB
- How to test react image component that gets it's src attribute from a REST api
- Context's Provider default value function gets invoked, not the function inside the Provider
- Why JavaScript frontend framework is needed for Node.js to run?
- AnchorEL component is invalid after a method is called the first time
- React TypeError: Cannot read property 'getDates' of undefined
- TypeError: editorState.getCurrentContent is not a function while using Draft.js Editor
- Custom contents <td> in ReactJS
- Flow Type error: property of unknown type. This type is incompatible with array type
- Function to expand div by time
- Can we get all <li> values using React ref on its <ul> parent?
- onChange event on input returns 'Cannot read property search of undefined'
- Got the error "Build optimization failed: found page without a React Component as default export in pages/"