I am getting this error when trying to fetch a document.
Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
It seems to get stuck when calling docRef.get()
Source code:
const docRef = firestore.collection('userOwned').doc(uid);
const doc = await docRef.get();
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/database';
import 'firebase/firestore';
const config = {
apiKey: '',
authDomain: '',
databaseURL: '',
projectId: '',
storageBucket: '',
messagingSenderId: ''
};
firebase.initializeApp(config);
const auth = firebase.auth();
const database = firebase.database();
const firestore = firebase.firestore();
export {
auth,
database,
firestore
};
jest.mock('../firebase', () => {
const firebasemock = require('firebase-mock');
const mockdatabase = new firebasemock.MockFirebase();
const mockauth = new firebasemock.MockFirebase();
const mocksdk = new firebasemock.MockFirebaseSdk(
path => {
return path ? mockdatabase.child(path) : mockdatabase;
},
() => {
return mockauth;
}
);
const mockfirestore = new firebasemock.MockFirestore();
const firebase = mocksdk.initializeApp(); // can take a path arg to database url
// optional - expose the mock
global.firebase = firebase;
// return the mock to match your export api
return {
auth: mockauth,
database: mockdatabase,
firestore: mockfirestore
};
});
import { firestore } from '../../firebase';
firestore
.collection('userOwned')
.doc(mockuid)
.set(mockdata);