The Wayback Machine - https://web.archive.org/web/20200905232330/https://github.com/microsoft/redux-dynamic-modules/issues/84
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more example options #84

Open
subtirelumihail opened this issue May 16, 2019 · 4 comments
Open

Add more example options #84

subtirelumihail opened this issue May 16, 2019 · 4 comments

Comments

@subtirelumihail
Copy link

@subtirelumihail subtirelumihail commented May 16, 2019

Please add more examples, because there is now example on how we can test a component that has been wrapped in the DynamicModuleLoader ?

@navneet-g
Copy link
Collaborator

@navneet-g navneet-g commented May 16, 2019

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.

@subtirelumihail
Copy link
Author

@subtirelumihail subtirelumihail commented May 17, 2019

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 ?

@navneet-g
Copy link
Collaborator

@navneet-g navneet-g commented May 22, 2019

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?

@subtirelumihail
Copy link
Author

@subtirelumihail subtirelumihail commented Jul 10, 2019

@navneet-g Yes

Also how should we mock the initialActions in a test case ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.