You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I'm trying to use this package to mock the router context but it still doesn't work event after context providing.
Here is my test.
Btw I also have a question. Even when I'm using the MemoryRouter and mount feature how I can test some method of my real component. enzymeWrapper.instance() doesn't work because the root component is MemoryRouter
Thanks for any help.
import * as React from "react";
// import { MemoryRouter } from "react-router-dom";
import {shallow, ShallowWrapper} from "enzyme";
import createRouterContext from 'react-router-test-context'
import Overview from "../src/modules/customer/Overview";
import { profilesStore } from "../src/store";
let overview: ShallowWrapper<undefined, undefined>;
beforeEach(function() {
overview=shallow(
<Overview profilesStore={profilesStore}/>,
{ context : createRouterContext() }
)
});
describe('Overview component test suite', () => {
it('should have an one section with id container', () => {
expect(overview.find("#container")).toHaveLength(1);
});
});
Here is the issue message Warning: Failed context type: The context router is marked as required in Component, but its value is undefined.
in Link
in header
in section
in default_1
The text was updated successfully, but these errors were encountered:
Hello. I'm trying to use this package to mock the router context but it still doesn't work event after context providing.
Here is my test.
Btw I also have a question. Even when I'm using the MemoryRouter and mount feature how I can test some method of my real component. enzymeWrapper.instance() doesn't work because the root component is MemoryRouter
Thanks for any help.
Here is the issue message
Warning: Failed context type: The context
router
is marked as required inComponent
, but its value isundefined
.in Link
in header
in section
in default_1
The text was updated successfully, but these errors were encountered: