How to correctly mock a React Native module that utilizes native code?
问题 I'm building a React Native app with TypeScript. I'm using react-native-firebase for my notifications. I'm furthermore using Jest and Enzyme for my unit tests. I have the following wrapper function to check the users permissions: export const checkPermissions = (): Promise<boolean> => new Promise((resolve, reject) => { firebase .messaging() .hasPermission() .then(enabled => { if (enabled) { resolve(enabled); } else { firebase .messaging() .requestPermission() .then(resolve) .catch(reject); }