title: How can I use Firebase Emulators to test my React App using Jest?
body: <p>I'm trying to use the FirebaseEmulator to test my react components that use Firebase RealtimeDatabase and Firebase Storage.</p>
  <p>App.tsx</p>
  <pre><code>import firebase from &quot;firebase/app&quot;;
  import 'firebase/storage'
  import { STORAGE_ROOT } from &quot;../../../../Work/hazy-webapp/src/model/storage/storage&quot;;
  import React, {useState} from 'react'
  
  export default ()=&gt;{
  
    const [url, setUrl] = useState&lt;null | string&gt;(null)
    
    const storageRef = firebase
      .storage()
      .ref('path/file').getDownloadURL().then((v)=&gt;{
        setUrl(v);
      })
  
    return &lt;div&gt;
      {url}
    &lt;/div&gt;
  }
  
  </code></pre>
  <p>And here's my test:</p>
  <p>App.test.tsx:</p>
  <pre><code>import {initializeTestApp, useEmulators} from '@firebase/rules-unit-testing'
  import App from '../App'
  
  useEmulators({
    storage:{
      host: 'localhost',
      port: 9199
    }
  })
  
  initializeTestApp({
    storageBucket: &quot;my-bucket&quot;,
    auth: { uid: &quot;alice&quot; }
  })
  
  describe('test', ()=&gt;{
    it('can match snapshot', () =&gt; {
      const { baseElement } = render(
          &lt;App/&gt;
      );
      expect(baseElement).toMatchSnapshot();
    })
  })
  
  
  </code></pre>
  <p>I'm constantly getting 'Uncaught [FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp()'</p>
  <p>Am I doing this right? thank you</p>