【发布时间】:2019-04-29 22:16:08
【问题描述】:
我想要类似以下的东西(实际上有效......):
import { NativeModules } from 'react-native';
import PushNotifications from '../../app/platform/PushNotificationSupport';
const mockRNA = jest.requireMock('react-native');
jest.mock('react-native', () => {
return {
default: mockRNA.default,
NativeModules: {
...mockRNA.NativeModules,
NativePushNotifications: {
setTokenHandler: jest.fn(),
},
},
};
});
当然,上面的代码实际上并不起作用。我基本上想在现有的react-native mock 之上构建。
【问题讨论】:
标签: react-native jestjs react-native-native-module