Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
Fixing prop types test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Cooke committed Jul 7, 2017
1 parent dfcc079 commit c94c3a1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
"flow-bin": "^0.40.0",
"jest": "^19.0.2",
"jest-jasmine2": "^19.0.2",
"react-test-renderer": "^15.5.1",
"react": "^15.5.1",
"react-dom": "^15.5.1"
"react": "15.5.1",
"react-dom": "15.5.1",
"react-test-renderer": "^15.5.1"
},
"peerDependencies": {
"react": "^15.5.1",
Expand Down
15 changes: 13 additions & 2 deletions src/components/decorators/__tests__/testWithRelayRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ describe('withRelayRenderer', () => {
});

describe('params', () => {
var consoleError;
beforeEach(() => {
consoleError = console.error;
console.error = jest.fn();
});
afterEach(() => {
console.error = consoleError;
});

it('should add proptypes to the wrapper', () => {
const Wrapper = withRelayRenderer({
queryConfig: {
Expand All @@ -126,8 +135,10 @@ describe('withRelayRenderer', () => {
}
}
})(Container);
expect(PropTypes.checkPropTypes(Wrapper.propTypes, {id: 'dsf'}, 'id', 'Wrapper')).toBe(null);
expect(PropTypes.checkPropTypes(Wrapper.propTypes, {}, 'id', 'Wrapper')).not.toBe(null);
PropTypes.checkPropTypes(Wrapper.propTypes, {id: 'dsf'}, 'id', 'Wrapper');
expect(console.error).not.toBeCalled();
PropTypes.checkPropTypes(Wrapper.propTypes, {}, 'id', 'Wrapper');
expect(console.error).toBeCalled();
});

it('should take params from props', () => {
Expand Down
29 changes: 10 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1187,14 +1187,6 @@ core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"

create-react-class@^15.6.0:
version "15.6.0"
resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.0.tgz#ab448497c26566e1e29413e883207d57cfe7bed4"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.3.1"
object-assign "^4.1.1"

[email protected]:
version "2.0.5"
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
Expand Down Expand Up @@ -2823,7 +2815,7 @@ oauth-sign@~0.8.1:
version "0.8.2"
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"

object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
object-assign@^4.0.1, object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"

Expand Down Expand Up @@ -3033,7 +3025,7 @@ promise@^7.1.1:
dependencies:
asap "~2.0.3"

prop-types@^15.5.10, prop-types@^15.5.8:
prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.8, prop-types@~15.5.0:
version "15.5.10"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
dependencies:
Expand Down Expand Up @@ -3068,14 +3060,14 @@ rc@~1.1.6:
minimist "^1.2.0"
strip-json-comments "~2.0.1"

react-dom@^15.5.1:
version "15.6.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.1.tgz#2cb0ed4191038e53c209eb3a79a23e2a4cf99470"
[email protected]:
version "15.5.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.5.1.tgz#05a75129171a5d4937cc206d4189a518149bee36"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "^15.5.10"
prop-types "~15.5.0"

[email protected]:
version "1.1.0"
Expand All @@ -3098,15 +3090,14 @@ react-test-renderer@^15.5.1:
fbjs "^0.8.9"
object-assign "^4.1.0"

react@^15.5.1:
version "15.6.1"
resolved "https://registry.yarnpkg.com/react/-/react-15.6.1.tgz#baa8434ec6780bde997cdc380b79cd33b96393df"
[email protected]:
version "15.5.1"
resolved "https://registry.yarnpkg.com/react/-/react-15.5.1.tgz#423ca8f4de9e1e119b056f1073a56ef2b7228c91"
dependencies:
create-react-class "^15.6.0"
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "^15.5.10"
prop-types "^15.5.0"

read-pkg-up@^1.0.1:
version "1.0.1"
Expand Down

0 comments on commit c94c3a1

Please sign in to comment.