Open Nitika123 opened 3 years ago
What is withReduxContext
? The second argument to mount
is an options object, not a context.
It is function which returns the following
return {
context: { store },
childContextTypes: {
store: PropTypes.object.isRequired
}
};
And the store is mocked in the following manner
import configureStore from 'redux-mock-store';
const initialState = {};
const mockStore = configureStore(middlewares);
beforeEach(() => {
store = mockStore(initialState);
});
I'm not sure why childContextTypes
would be in that object; mount
doesn't look at that property there.
What I'd suggest is using a context provider in the wrappingComponent
option. However, you're also using an old version of enzyme (it's on v3.11) and possibly your adapter.
Can you start by upgrading enzyme, and your enzyme adapter, and then see if that fixes the issue?
Current behavior
I am writing unit test cases fro my component. I have two selection boxes on my page
Selection box 2 options appear on the basis of selection from 1. Initially the selection box 2 is hidden.
I wrote the following test case which is working fine as initially will be saving only one selection box:
But when I add the following case of simulating click it fails as it is still showing 1 selection box on the page.
Expected behavior
When I search for selection boxes, it is reporting only 1. I have tried using
Your environment
Linux 2012 4.9 Kernel
API
Version
Adapter