Fix missing mock for StatusBarManager
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 https://github.com/facebook/react-native/pull/11198 Differential Revision: D4246367 Pulled By: cpojer fbshipit-source-id: ee9406d2566688d235a11cab8f24b0583698e93a
This commit is contained in:
parent
346858a552
commit
39554ab32c
|
@ -131,6 +131,7 @@ const mockNativeModules = {
|
||||||
SourceCode: {
|
SourceCode: {
|
||||||
scriptURL: null,
|
scriptURL: null,
|
||||||
},
|
},
|
||||||
|
StatusBarManager: {},
|
||||||
Timing: {
|
Timing: {
|
||||||
createTimer: jest.fn(),
|
createTimer: jest.fn(),
|
||||||
deleteTimer: jest.fn(),
|
deleteTimer: jest.fn(),
|
||||||
|
|
Loading…
Reference in New Issue