I am using Mocha, Chai, Karma, Sinon, Webpack for Unit tests.
I’m developing a web app at work in React/Redux/Webpack and am now starting to integrate testing with Mocha.
I’m testing a react component with Mocha and Enzyme. Here is the component (shortened for simplicity of course):
I am using enzyme+mocha+chai to test my react-redux project. Enzyme provides shallow to test component behavior. But I didn’t find a way to test the router. I am using react-router as below:
Background I am porting some npm scripts to Webpack loaders to better learn how Webpack works and I’ve got everything working except for my Mocha tests: I have one failing test, but it is not showing that Mocha is being run with the mocha-loader or that the test is failing: Question What do I need … Read more
I am trying to update my unit tests by using mocha and enzyme. The code that I am testing is in ES6, using JSX and React.
I’m new to Mocha and I am trying to use it to test a simple React component. The test would pass if the react component doesn’t have any CSS styling but throws a syntax error if the tag within the React component contains any className:
I’m trying to write tests for my simple React App that creates a UI for a dog Shelter using API etc. I have imported the modules shown below and ran the following command
I am following this tutorial: http://reactkungfu.com/2015/07/approaches-to-testing-react-components-an-overview/
I have been working on a React app with a new team and the discussion came up around writing unit tests for components that trigger methods on window.scroll events.