Skip to content

Unit test firestore: Mocking DocumentReference and CollectionReference #3263

Closed
@einevea

Description

@einevea

We are trying to test classes with dependencies on firestore and we found we cannot mock these classes because their constructors are internal. Is it possible if the following methods return interfaces instead of classes:

val collectionReference:CollectionReference = db.collection(collectionName)
val document: DocumentReference = collectionReference.document(docId)

Metadata

Metadata

Labels

api: firestoreIssues related to the Firestore API.priority: p2Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions