Added mock for code-push plugin in test of demo app. (#1298)

This commit is contained in:
Nickolay Toropov
2018-05-30 11:22:32 +03:00
committed by GitHub
parent dea708813f
commit 9662c85ba6

View File

@@ -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(
<App />