Updated PropTypes test to work with newer prop-types version (#9471)

The prop-types lib got an anti-spamming change in 15.5.8 that broke some of our tests (see reactjs/prop-types/commit/e1d51dd0efbd0eee5e4a8d24759f2a4d518721d3). This PR resolves that by resetting the prop-types import between tests.
This commit is contained in:
Brian Vaughn
2017-04-20 12:48:53 -07:00
committed by GitHub
parent 28bc8860bc
commit 73ca89408b
@@ -22,6 +22,7 @@ var MyComponent;
function resetWarningCache() {
jest.resetModules();
checkPropTypes = require('prop-types/checkPropTypes');
PropTypes = require('ReactPropTypes');
}
function getPropTypeWarningMessage(propTypes, object, componentName) {
@@ -99,6 +100,7 @@ function expectWarningInDevelopment(declaration, value) {
var props = {testProp: value};
var propName = 'testProp' + Math.random().toString();
var componentName = 'testComponent' + Math.random().toString();
resetWarningCache();
for (var i = 0; i < 3; i++) {
declaration(props, propName, componentName, 'prop');
}
@@ -111,7 +113,6 @@ function expectWarningInDevelopment(declaration, value) {
describe('ReactPropTypes', () => {
beforeEach(() => {
PropTypes = require('ReactPropTypes');
React = require('react');
ReactDOM = require('react-dom');
resetWarningCache();