redux-dynamic-modules
redux-dynamic-modules copied to clipboard
Add more example options
Please add more examples, because there is now example on how we can test a component that has been wrapped in the DynamicModuleLoader ?
Can you give an example of what exactly you are trying to test?
Dynamic module loader just adds redux artifacts to the store. The underlying components and its tests need not know about redux-dynamic-modules.
So I have a component that looks like this:
const Example = () => (
<DynamicModuleLoader modules={[module()]}>
<ExampleComponent />
</DynamicModuleLoader>
);
I want to be able to test this component without using the react-redux Provider component
describe('Example', () => {
it('should render correctly', () => {
render(
<Provider store={store}>
<Example />
</Provider>
);
});
});
So basically what I mean is can I mock DynamicModuleLoader ?
The ExampleComponent should know nothing about DynamicModuleLoader. What is the test case and asserts you expect in your test? Are you trying to test that the component is wrapped with DynamicModuleLoader with given set of modules?
@navneet-g Yes
Also how should we mock the initialActions in a test case ?