score:0
the method you want to call resides inside the instance of the wrapper. that means you need to call it like this:
wrapper.instance().nextpage();
setup your test file like this:
import react from "react";
import { mount } from 'enzyme';
describe('testing component',() => {
let wrapper = mount(<invoice store = {store} />)
test('testing nextpage method', ()=>{
wrapper.instance().nextpage();
expect(wrapper.state('currentpage')).toequal('the value you want here');
});
});
hope this helps!
Source: stackoverflow.com
Related Query
- How to write test case for ErrorBoundary in React using Jest / Enzyme
- How to write test case by using jest for Increment using React Hooks
- How to write a test case for a simple React component using Jest and Enzyme
- How to write unit test case using jest in react?
- How to unit test a react event handler that contains history.push using Jest and Enzyme?
- How to write test case using Jest for Yup.isValid function?
- How to unit test switch case in React using Jest?
- How to write Test cases for useEffect Hook in React using Jest & Enzyme?
- How do I write state case for the state in react useState using Jest
- How do I unit test amcharts using jest with react and typescript?
- How to write test case coverage in Jest and Enzyme for indexOf used inside React Component
- how to unit test react reduxsauce saga using jest and enzyme?
- write unit test for event handlers that updates some state in react using jest and enzyme
- How to write test case for a component which is calling a method using jest
- How to unit test useEffect cleanUp return function using Jest and Enzyme
- How to unit test a style of a React Component using Jest.js?
- How can I write a unit test for a react component that calls reduxjs's mapStateToProps?
- How to test API calls in react using jest and enzyme?
- JS unit testing using enzyme: how to wait for setState within component's method to finish before proceeding with test case
- How to test below component in React using JEST
- How to test events created with mousetrap in react using jest
- How to properly test React Native Modals using Jest and Native Testing Library
- How do I write test case for a function which uses uuid using jest?
- How to write test cases for tabs in material-ui using react testing library
- How to check the value of a nested React component in a unit test with Enzyme and Jest
- React Unit test using jest failed
- how to test Routes in react using jest and react testing library
- How can i write a test using React Testing Library to check if hover changes the components style?
- How to write unit test redux connected components in next.js app with Jest end Enzyme
- how to test OnSubmit in React using Jest and Enzyme
More Query from same tag
- change brand details by selecting options javascript
- Module not found: Error: Can't resolve 'fs' react js
- getting 'NULL' error while I am testing 'document.getElementByID' line. I already tried attachTo approach but that is also not working
- Vertically center text inside grid element
- Cannot read property 'push' of undefined - React error
- Nextjs dynamic routes - how to pass props from parent to dynamic route child
- Why do react MobileStoreButtons have different shapes?
- React Hooks setState on update to push new object return duplicates / multiple object per each push
- React button onClick event call other component
- ReactJs : `npm run build` fails with Exit status 1
- How can I know redux-form resetForm() is completed?
- What is wrong with my useEffect()? It return empty object
- How to write a jest unit-test using the gatsby.navigate function?
- React.js - add div's on the fly
- How to use code splitting with webpack in react app with components exported as export * from '...'
- setState in redux from fetch()
- React-Firebase routing and authentication approach
- Stop sending preflight requests from axios.post
- Change button bgcolor depends on props
- Where to add axios interceptors in reactjs
- Centering table created using array map in react web app
- Change the element wrapping its children based on a condition in JSX
- React read file added in dist folder after deploy
- React FormEvent<HTMLFormElement> form input props types
- How could i use the routing in reactjs to redirect from one page after loading to another url
- Why a div after a <header> is not displaying under the header?
- why not working document.body.style.backgroundColor?
- React: How to logout users when refresh token is expired while automatically logging in those that aren't yet
- How to get same width in material-ui card component?
- How to set the "save" button to summit and not "new"