test NavLink with jest code example
Example: jest test navlink
import React from 'react';
import { expect } from 'chai';
import { shallow, mount, render } from 'enzyme';
import { NavLink } from 'react-router-dom';
describe("<NavLink />", () => {
it("1.contains correct passed prop", () => {
const comp = (
<NavLink to="/home" className={"test"}>
NaveLink Test
</NavLink>
);
const wrapper = shallow( comp );
expect(wrapper.instance().props.to).to.equal("/home");
});
});