Top "Enzyme" questions

Unit test library for React.

How to test componentDidUpdate()?

This is an example implementation: export class Person extends Component { componentDidMount() { const { onLoadProfile, onLoadPolicy, person } = this.props onLoadProfile(person.profile.…

reactjs react-redux jestjs enzyme
TypeError: Cannot read property 'prepareStyles' of undefined

My Component looks like import React, {PropTypes} from 'react'; import TransactionListRow from './TransactionListRow'; import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow} …

javascript reactjs material-ui enzyme
How to test a component using react-redux hooks?

I have a simple Todo component that utilizes react-redux hooks that I'm testing using enzyme but I'm getting either an …

reactjs testing redux react-redux enzyme
How to mock react-router context

I've got fairly simple react component (Link wrapper which adds 'active' class if route is active): import React, { PropTypes } from …

reactjs react-router enzyme
Jest Enzyme test a React component that returns null in render method

I have a component that returns null in render under certain conditions: render() { if (this.props.isHidden) { return null; } return &…

javascript reactjs jestjs enzyme
TypeError: Cannot read property 'contextTypes' of undefined

I'm trying to test a React-app with Jest. I use Enzyme's shallow to render my App.js component in App-test-js …

unit-testing reactjs jestjs enzyme
Testing React components that fetches data using Hooks

My React-application has a component that fetches data to display from a remote server. In the pre-hooks era, componentDidMount() was …

reactjs jestjs enzyme react-hooks react-test-renderer
Passing an event object to enzyme .simulate

I am using Jest and Enzyme to test a React checkbox component. This is my test: it('triggers checkbox onChange …

javascript reactjs jestjs enzyme
How should I test React Hook "useEffect" making an api call with Typescript?

I'm writing some jest-enzyme tests for a simple React app using Typescript and the new React hooks. However, I can't …

typescript jestjs axios enzyme react-hooks
How to unit test a react event handler that contains history.push using Jest and Enzyme?

Given a simple component: export default class SearchForm extends Component { constructor(props) { super(props) this.state = { query: '' } } onSubmit = (event) =&…

reactjs unit-testing jestjs enzyme html5-history