react-native/jest
ZauberNerd 31a0b8788f Add jest mock for 'PushNotificationManager'
Summary:
`PushNotificationIOS` is a library that makes use of the
`PushNotificationManager` native module.
This commit adds a jest mock for its native module so that code that
uses `PushNotificationIOS` can be tested using jest.

In order to enable behaviour in unit tests it is possible to replace or
overwrite the mock implementation, see the [jest guide on
mocks](https://facebook.github.io/jest/docs/mock-functions.html).
By doing something similar to:
```javascript
import { NativeModules } from 'react-native';
const { PushNotificationManager } = NativeModules;
// mock 'checkPermissions' to return a different value than the default:
PushNotificationManager.checkPermissions.mockImplementationOnce((callback) => {
    // execute callback in next tick to enable async behaviour
    process.nextTick(() => callback({
        alert: false,
        badge: false,
        sound: false
    }));
});
// execute unit tests for code that makes use of 'PushNotificationIOS'
```
Closes https://github.com/facebook/react-native/pull/13410

Differential Revision: D5043904

Pulled By: cpojer

fbshipit-source-id: 11e73cd215ba6854d06f4ac7a5aea0ab4be26584
2017-05-11 03:50:52 -07:00
..
mockComponent.js RN: Cleanup OSS JS & Flow Declarations 2016-11-20 17:58:29 -08:00
preprocessor.js Stronger typing for transformers 2017-05-09 08:02:36 -07:00
setup.js Add jest mock for 'PushNotificationManager' 2017-05-11 03:50:52 -07:00