Skip to content

Test coverage when using enhancer? #603

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

Closed
raed667 opened this issue Dec 9, 2018 · 3 comments
Closed

Test coverage when using enhancer? #603

raed667 opened this issue Dec 9, 2018 · 3 comments

Comments

@raed667
Copy link

raed667 commented Dec 9, 2018

How would one go about testing adding this enhancer with jest?

I have this example (link)

something like this:

if (process.env.NODE_ENV === 'development') {
const devToolsExtension = window['__REDUX_DEVTOOLS_EXTENSION__'];
if (typeof devToolsExtension === 'function') { // this line
  enhancers.push(devToolsExtension()); // and this line 
}
}
@raed667 raed667 changed the title Coverage when using enhancer? Test coverage when using enhancer? Dec 9, 2018
@raed667 raed667 closed this as completed Dec 9, 2018
@raed667 raed667 reopened this Dec 9, 2018
@zalmoxisus
Copy link
Owner

zalmoxisus commented Dec 10, 2018

You can include redux-devtools-extension npm package instead, so there will be no need to test the globals. The test should just check if devToolsEnhancer returns a noop function. Or in case of composeWithDevTools it returns the same function as require('redux').compose.

If you want, you can test the enhancer itself like here.

@raed667
Copy link
Author

raed667 commented Dec 11, 2018

@zalmoxisus
Copy link
Owner

Yes, just there will be not much difference in development. You could also try to add our instrumentation enhancer (maybe we could also export the other parts) and check if dispatch and getState doesn't break anything, but I guess for most of cases that's not necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants