Skip to content

The mystery of Unit Testing with Firestore #17

Open
@chstrong

Description

@chstrong

Dear Resocoder,

Your tutorial is absolutely fantastic.

However, one mystery remains, and this is unit testing the NoteRepository class and the NoteWatcherBloc, and NoteActorBloc class with Firestore.

This is therefore a "feature" request.

Your tutorial is great but can get very complex for amateur programmers. So I'm trying a test-driven approach for your domain driven tutorial, in order to solve each concern separately. I'm starting therefore with the domain and infrastructure / repository layer.

Mockito doesn't seem to be able to accept constructors and hence I can't pass a Mock instance of Firebase to the repository, or the Bloc. At the moment I'm thinking of writing an additional method in the NoteRepository which I can use to parse the Firebase Mock instance, but I'm sure you will scream at me and tell me it's not good code practice :) And the problem with the Bloc still remains.

I think a separate video would be helpful that explains how to test repository and bloc classes with Firestore.

There is nobody, that is showing this, so it seems to be a complex topic that nobody can copy, as there are no examples :).

Or all use AWS Lambda with JSON and nobody uses Firebase :)

All are showing FirebaseAuth, but nobody shows how to test repository classes and blocs. I didn't figure out how to do it yet but am working on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions