Yes that's perfectly safe. Similarly to
setTimeout(callback, 0), promise callbacks are queued to run after the rest of the synchronous code. This ensures your assertions will run at the correct points in your program.
Small tip for unit testing - instead of calling
c.instance().handleClick() I would call
c.find('button').prop('onClick')(). Your component is the "unit" that you're testing and so you should try to avoid accessing internal methods / properties
- React testing state of component with Jest and Enzyme
- Testing debounced function in React component with Jest and Enzyme
- Testing component function in React with Enzyme and Jest
- How to mock React component methods with jest and enzyme
- Accessing the State of a Functional Component with React Hooks when Testing with Enzyme
- Testing changes to React component state and spying on instance methods using enzyme
- How to read console.log from a mounted component with Enzyme and Jest in Create React App
- _this.store.getState is not a function when testing react component with enzyme and mocha
- Testing component with react-router v4, Jest and Enzyme
- How to test redux state update with react testing library and jest
- Testing React Router with Jest and Enzyme
- React testing with Jest and Enzyme (in Symfony) got "Syntax Error: Unexpected token import"
- Getting started testing React components with Enzyme and Jest
- Testing Material UI Component with Jest and Enzyme
- Testing React component with Enzyme Jest finding HTML element
- How to check the value of a nested React component in a unit test with Enzyme and Jest
- How to test styles and media queries rendered by a React component with Jest and/or Enzyme
- testing custom react methods with jest and enzyme
- Test an whole table React component cells with jest and Enzyme
- Waiting for React component state to update before testing with Jest
- Testing asynchronous componentDidMount that changes state with Jest and Enzyme
- Testing a React Hooks component with Jest / Enzyme & Axios
- How to mock React component events with jest and enzyme
- Testing react app with jest and enzyme token problem
- React testing with Jest and Enzyme @react-google-maps/api returns TypeError: Cannot read property 'maps' of undefined
- Testing react component with enzyme and expect fails
- Testing a React component with Jest / Enzyme & Axios
- Mock a custom service with jest and enzyme for a react component
- Testing component created using styled component with jest and enzyme
- Testing With Jest and Enzyme. Spy On a method of a react component
More Query from same tag
- Typescript and React (with Gatsby loader): unable to import images as modules
- React autocomplete with react-virtualized to render and search through large data set
- css-loader css modules rules of nested component
- Programatically change Redux-Form Checkbox Field value
- Parent container margin effecting the child margin
- How to change other components' property with styled-components?
- How to load a <div> on top of React google map component?
- Does React suspense have other use cases apart from code splitting?
- React App - button click taking iphone users to top of screen
- React.js tells you to cancel promises. Official Promises can't be cancelled. What am I supposed to do instead?
- Why is mapped children component not rendering in enzyme wrapper using mount?
- variable value not changing inside axios then method
- How to bind a socket.on method to a React functional component
- Conditional rendering of JSX based on JSON value not matching
- setState doesn't render (fetch in a ftech)
- how get get file name in file chooser in react?
- (Next.js) Thunk does not trigger reducer
- Can't use document in gatsby build, must convert to hooks
- How can i redirect on submitting my form in reactjs and using formik
- React SetState to update An Array and save to Firestore
- What is the difference between @material-ui and @mui
- MongoDB struggling to update DB
- Reactjs correction
- How to add a className to an EasyUI react component
- MateralizeCSS (tabs, collapsibles, buttons) not working correctly: React.js (render)
- Use firebase onSnapshot() in for loop?
- update a component after axios post
- Draft.js. How to get all entities data from the ContentState
- Map 2 arrays of object to make a loop
- interface states and props in typescript react