-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[jest] Fix missing mock for StatusBarManager #11198
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix an issue when running Jest unit tests due to a missing mock for StatusBarManger. More info: In one of my files I have: ``` export const STATUS_BAR_HEIGHT = (StatusBar.currentHeight || 0); ``` When I run the tests it gives this error, which seems to be because StatusBarManager is undefined (https://github.com/facebook/react-native/blob/master/Libraries/Components/StatusBar/StatusBar.js#L20) ``` TypeError: Cannot read property 'HEIGHT' of undefined at Object.<anonymous> (node_modules/react-native/Libraries/Components/StatusBar/StatusBar.js:395:1823) at Object.StatusBar (node_modules/react-native/Libraries/react-native/react-native.js:55:24) ``` **Test plan (required)** Verify that with this change tests that use StatusBar pass.
By analyzing the blame information on this pull request, we identified @cpojer to be a potential reviewer. |
@cpojer Fix for StatusBar from jestjs/jest#1840. Thanks for your help! |
@cpojer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
:) |
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Nov 29, 2016
cooperka
added a commit
to cooperka/react-native
that referenced
this pull request
Nov 29, 2016
In the same vein as facebook#11198
facebook-github-bot
pushed a commit
that referenced
this pull request
Nov 29, 2016
Summary: **Description** In the same vein as #11198, this adds a mock for the native module `AppState`. **Test plan** Create a component that uses `AppState`, e.g. ```jsx import React, { Component } from 'react'; import { AppState } from 'react-native'; class TestComponent extends Component { componentDidMount() { AppState.addEventListener('change', this.stateChangeListener); } } ``` Closes #11199 Differential Revision: D4246668 Pulled By: cpojer fbshipit-source-id: e3a73a98963a0e152a70aba78ef3461b86da0f6c
robclouth
pushed a commit
to robclouth/react-native
that referenced
this pull request
Dec 7, 2016
Summary: **Description** In the same vein as facebook#11198, this adds a mock for the native module `AppState`. **Test plan** Create a component that uses `AppState`, e.g. ```jsx import React, { Component } from 'react'; import { AppState } from 'react-native'; class TestComponent extends Component { componentDidMount() { AppState.addEventListener('change', this.stateChangeListener); } } ``` Closes facebook#11199 Differential Revision: D4246668 Pulled By: cpojer fbshipit-source-id: e3a73a98963a0e152a70aba78ef3461b86da0f6c
robclouth
pushed a commit
to robclouth/react-native
that referenced
this pull request
Dec 7, 2016
Summary: Fix an issue when running Jest unit tests due to a missing mock for StatusBarManger. **More info:** In one of my files I have: ``` export const STATUS_BAR_HEIGHT = (StatusBar.currentHeight || 0); ``` When I run the tests it gives this error, which seems to be because StatusBarManager is undefined (https://github.com/facebook/react-native/blob/master/Libraries/Components/StatusBar/StatusBar.js#L20) ``` TypeError: Cannot read property 'HEIGHT' of undefined at Object.<anonymous> (node_modules/react-native/Libraries/Components/StatusBar/StatusBar.js:395:1823) at Object.StatusBar (node_modules/react-native/Libraries/react-native/react-native.js:55:24) ``` **Test plan (required)** Verify that with this change tests that use StatusBar pass. Closes facebook#11198 Differential Revision: D4246367 Pulled By: cpojer fbshipit-source-id: ee9406d2566688d235a11cab8f24b0583698e93a
DanielMSchmidt
pushed a commit
to DanielMSchmidt/react-native
that referenced
this pull request
Jan 4, 2017
Summary: **Description** In the same vein as facebook#11198, this adds a mock for the native module `AppState`. **Test plan** Create a component that uses `AppState`, e.g. ```jsx import React, { Component } from 'react'; import { AppState } from 'react-native'; class TestComponent extends Component { componentDidMount() { AppState.addEventListener('change', this.stateChangeListener); } } ``` Closes facebook#11199 Differential Revision: D4246668 Pulled By: cpojer fbshipit-source-id: e3a73a98963a0e152a70aba78ef3461b86da0f6c
DanielMSchmidt
pushed a commit
to DanielMSchmidt/react-native
that referenced
this pull request
Jan 4, 2017
Summary: Fix an issue when running Jest unit tests due to a missing mock for StatusBarManger. **More info:** In one of my files I have: ``` export const STATUS_BAR_HEIGHT = (StatusBar.currentHeight || 0); ``` When I run the tests it gives this error, which seems to be because StatusBarManager is undefined (https://github.com/facebook/react-native/blob/master/Libraries/Components/StatusBar/StatusBar.js#L20) ``` TypeError: Cannot read property 'HEIGHT' of undefined at Object.<anonymous> (node_modules/react-native/Libraries/Components/StatusBar/StatusBar.js:395:1823) at Object.StatusBar (node_modules/react-native/Libraries/react-native/react-native.js:55:24) ``` **Test plan (required)** Verify that with this change tests that use StatusBar pass. Closes facebook#11198 Differential Revision: D4246367 Pulled By: cpojer fbshipit-source-id: ee9406d2566688d235a11cab8f24b0583698e93a
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix an issue when running Jest unit tests due to a missing mock for StatusBarManger.
More info:
In one of my files I have:
When I run the tests it gives this error, which seems to be because StatusBarManager is undefined (https://github.com/facebook/react-native/blob/master/Libraries/Components/StatusBar/StatusBar.js#L20)
Test plan (required)
Verify that with this change tests that use StatusBar pass.