From 9662c85ba6ff1bec251bf9ea9bcff9ac3954f9c1 Mon Sep 17 00:00:00 2001 From: Nickolay Toropov Date: Wed, 30 May 2018 11:22:32 +0300 Subject: [PATCH] Added mock for code-push plugin in test of demo app. (#1298) --- Examples/CodePushDemoApp/__tests__/App.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Examples/CodePushDemoApp/__tests__/App.js b/Examples/CodePushDemoApp/__tests__/App.js index d0b9ee3..2b71cba 100644 --- a/Examples/CodePushDemoApp/__tests__/App.js +++ b/Examples/CodePushDemoApp/__tests__/App.js @@ -5,6 +5,29 @@ import App from '../App'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; +jest.mock('react-native-code-push', () => { + const cp = (_) => (app) => app; + Object.assign(cp, { + InstallMode: {}, + CheckFrequency: {}, + SyncStatus: {}, + UpdateState: {}, + DeploymentStatus: {}, + DEFAULT_UPDATE_DIALOG: {}, + + checkForUpdate: jest.fn(), + codePushify: jest.fn(), + getConfiguration: jest.fn(), + getCurrentPackage: jest.fn(), + getUpdateMetadata: jest.fn(), + log: jest.fn(), + notifyAppReady: jest.fn(), + notifyApplicationReady: jest.fn(), + sync: jest.fn(), + }); + return cp; +}); + it('renders correctly', () => { const tree = renderer.create(