From ed3b71fc59027727eefbbf2780a7033bc473b3c6 Mon Sep 17 00:00:00 2001 From: Nelen Date: Tue, 6 Dec 2016 05:43:42 -0800 Subject: [PATCH] Added mocked functions to StatusBarManager Summary: **Description:** Jest tests that use that StatusBar failing because the status bar functions aren't mocked. Errors I ran into: `TypeError: StatusBarManager. setNetworkActivityIndicatorVisible is not a function` `TypeError: StatusBarManager. setHidden is not a function` `TypeError: StatusBarManager. setStyle is not a function` **Fix:** Added mocks for all the functions that the StatusBar offers according to the docs: https://facebook.github.io/react-native/docs/statusbar.html **Test plan (required)** Verify that the tests using StatusBar and its functions succeed. Closes https://github.com/facebook/react-native/pull/11322 Differential Revision: D4284536 Pulled By: cpojer fbshipit-source-id: b67be8c0595d91ee9aca4784f457c0959d7e45d5 --- jest/setup.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jest/setup.js b/jest/setup.js index 5b18f88b64b..cab0eb220a9 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -131,7 +131,13 @@ const mockNativeModules = { SourceCode: { scriptURL: null, }, - StatusBarManager: {}, + StatusBarManager: { + setStyle: jest.fn(), + setHidden: jest.fn(), + setNetworkActivityIndicatorVisible: jest.fn(), + setBackgroundColor: jest.fn(), + setTranslucent: jest.fn(), + }, Timing: { createTimer: jest.fn(), deleteTimer: jest.fn(),