Top "Enzyme" questions

Unit test library for React.

How do you test router match params with jest and enzyme?

Say I have the following component which I grabbed from https://www.codeday.top/2017/11/08/56644.html. Here I am using match.…

reactjs typescript react-router jestjs enzyme
React & Enzyme: why isn't beforeEach() working?

I'm writing my first React tests and running into an issue where my beforeEach statement isn't working. Here's my test …

reactjs testing jestjs enzyme
How to mock useHistory hook in jest?

I am using UseHistory hook in react router v5.1.2 with typescript? When running unit test, I have got issue. TypeError: …

reactjs typescript react-router jestjs enzyme
How do you generate a blur or onBlur event in Enzyme?

I've tried: input.simulate('blur'); and input.simulate('onBlur'); None of these work. Is this even available in Enzyme (I'm …

unit-testing reactjs frontend enzyme
Testing with React's Jest and Enzyme when simulated clicks call a function that calls a promise

React v15.1.0 Jest v12.1.1 Enzyme v2.3.0 I'm trying to figure out how to test a component that calls a promise …

asynchronous reactjs promise jestjs enzyme
Enzyme: Method “text” is only meant to be run on a single node. 0 found instead

I'm using React v15.4, babel-jest v18 and enzyme v2.5.1 I have a simple React Component: import React, {Component} from 'react' …

reactjs jestjs enzyme
How can I test a change handler for a file-type input in React using Jest/Enzyme?

I want to test whether my React component can use FileReader to import the contents of a user-selected file from …

javascript reactjs filereader jestjs enzyme
Nested components testing with Enzyme inside of React & Redux

I have a component SampleComponent that mounts another "connected component" (i.e. container). When I try to test SampleComponent by …

reactjs mocha redux enzyme
Testing react component enclosed in withRouter (preferably using jest/enzyme)

I have a React component which is enclosed within Higher Order Component withRouter as below: module.exports = withRouter(ManageProfilePage); My …

reactjs unit-testing react-router jestjs enzyme
TypeError: Cannot read property 'equal' of undefined

I am trying to use enzyme to assert DOM nodes. My Component looks like import React, {Component} from 'react'; import …

javascript reactjs jestjs enzyme chai