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 reac
This will only pass if the component is rendered successfully: It works with Redux and react-router including hooks.
import React from "react";
import { expect } from "chai";
import { mount } from "enzyme";
import { MemoryRouter, Route } from "react-router-dom";
import { createMockStore } from "redux-test-utils";
import { Provider } from "react-redux";
...
describe(" ", () => {
it("renders the component", () => {
let props = {
index: 1,
value: 1
};
let state = {};
const wrapper = mount(
);
expect(wrapper.find(ProcessedFrames.WrappedComponent)).to.have.lengthOf(1);
});
});