I'm using .toObject(...) when calling Firestore methods:
firestore.collection(collectionPath)
.document(documentId).get().await()
.toObject(MyClass::class.java)
and I'm wondering how to mock this call using MockK in Kotlin Android Studio.
The mock is:
val mockFirestore: FirebaseFirestore = mockk {
coEvery {
collection(path)
.document(documentId)
.get()
} returns mockTask<DocumentSnapshot>(documentSnapshot)
}
trying .to to see what completions pop up results in .toString(), .toStr() and .toArray().
The error is:
io.mockk.MockKException: no answer found for DocumentSnapshot(#1).toObject(class ...) among the configured answers: (DocumentSnapshot(#1).getId())
how can I mock the call to .toObject(class)?