Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 9662c85

Browse files
authored
Added mock for code-push plugin in test of demo app. (#1298)
1 parent dea7088 commit 9662c85

File tree

1 file changed

+23
-0
lines changed
  • Examples/CodePushDemoApp/__tests__

1 file changed

+23
-0
lines changed

Examples/CodePushDemoApp/__tests__/App.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ import App from '../App';
55
// Note: test renderer must be required after react-native.
66
import renderer from 'react-test-renderer';
77

8+
jest.mock('react-native-code-push', () => {
9+
const cp = (_) => (app) => app;
10+
Object.assign(cp, {
11+
InstallMode: {},
12+
CheckFrequency: {},
13+
SyncStatus: {},
14+
UpdateState: {},
15+
DeploymentStatus: {},
16+
DEFAULT_UPDATE_DIALOG: {},
17+
18+
checkForUpdate: jest.fn(),
19+
codePushify: jest.fn(),
20+
getConfiguration: jest.fn(),
21+
getCurrentPackage: jest.fn(),
22+
getUpdateMetadata: jest.fn(),
23+
log: jest.fn(),
24+
notifyAppReady: jest.fn(),
25+
notifyApplicationReady: jest.fn(),
26+
sync: jest.fn(),
27+
});
28+
return cp;
29+
});
30+
831
it('renders correctly', () => {
932
const tree = renderer.create(
1033
<App />

0 commit comments

Comments
 (0)