onefinestay / react-daterange-picker

Other
563 stars 208 forks source link

Test memory fix #87

Closed nicolassenechal closed 8 years ago

nicolassenechal commented 8 years ago

What does this PR do?

This PR fixes a memory leak connected to TestUtils.renderIntoDocument which would cause karma to crash if more tests were to get added.

How do I validate this PR?

Tests still need to be passing. One could output to the console the result of React.unmountComponentAtNode used in the afterEach

What does this PR do not do?

It does not cover ShallowRenderer. Based on what is coming in the next version of React, we might want to rewrite the tests using the Shallow Renderer are these tests are very hard to read and maintain. If we decide to keep the Shallow Renderer, we might want to rename the output of both useDocumentRenderer and useShallowRenderer to be more explicit.

AlanFoster commented 8 years ago

In the future we may wish to DRY this out, but we'll keep an eye on this and cross that bridge when we come to it. Thanks for the PR!