samedi 22 septembre 2018

How to test epics middleware in flutter?

A few posts recommended using redux since it makes testing easier but I can't find much on how to test the epic middleware which is a key part of my app.

I was thinking of testing it somehow like this

  test("Add Group To Repository", () {
    final mockGroupRepository = MockGroupRepository();
    final store = new Store<AppState>(appReducer,
    initialState: new AppState.initial(),
    middleware: [createEpic(mockGroupRepository)]);
    Group group = new Group(groupName: "Group", groupPassword: "Password");
    store.dispatch(AddGroupAction(group));
    verify(mockGroupRepository.addGroup(group));
});

I have very little experience with testing and it's something that hasn't been easy to find resources for an absolute beginner.

How can I go about doing this epics testing?

Aucun commentaire:

Enregistrer un commentaire