title: Test firebase cloud messaging with Jest
body: <p>I am trying to test firebase cloud messaging with jest but I have an error with my mock function...</p>
  
  <p>How can I test all function invocations? </p>
  
  <p><code>expect(jest.fn()).toHaveBeenCalled()</code><br>
  <code>Expected mock function to have been called.</code></p>
  
  <pre><code>import { Sentry, SentrySeverity } from 'react-native-sentry';
  import RNFirebase from 'react-native-firebase';
  import Veery from 'react-native-veery';
  
  export default function firebaseCloudMessaging() {
    try {
      const firebase = RNFirebase.app().messaging();
  
      firebase.getToken().then(Veery.setVeeryToken);
  
      firebase.getInitialNotification();
  
      firebase.onMessage(Veery.VeeryNotificationHandler);
  
      firebase.onTokenRefresh(Veery.setVeeryToken);
    } catch (error) {
      Sentry.captureException(error, { level: SentrySeverity.Error });
      console.warn('Error with firebaseCloudMessaging ', error);
    }
  }
  </code></pre>
  
  <p>my test : 
  <a href="https://gist.github.com/ludwigCDSBDX/82749eb20eac44fffac8d5318864eb6f" rel="nofollow noreferrer">https://gist.github.com/ludwigCDSBDX/82749eb20eac44fffac8d5318864eb6f</a></p>
  
  <p>Thank you!</p>