Hello again!
I'm looking for some advices on how to handle these scenarios:
- Create Scenario -
Suppose you have 2 interactors, one that creates a table and another that creates a table revision, the behavior I want to test is, when you create a table, a default table revision is created and given to it, so I want to assure that when I create table A, its revision is 0.0.1.
How would you test this? I thought of two different approaches:
1 - I'd create a spy for the table interactor and a spy for the revision, so I'd check that the table interactor created and sent a request to the revision with the right parameters. (then I dont know if I should test the execution of the revision interactor as a whole, or just that it received the right request, because I think that testing the revision interactor itself should be a different test).
2 - I'm still not really sure whether it would be ok to have my CreateTableInteractor return a table entity (instead of returning void), assuming that It would, I could check that the table.Revision is equal to a default revision.
- Save Scenario -
3- Speaking strictly about unit testing, how would you test a save method in a gateway? would you just ensure that it was called with the right parameters?
What I'm trying to do is slowly add unit tests to a legacy code base, in which the relationship between the domain objects are really confusing and wide, this table example is the easiest part of the whole feature, considering this, is it common to have mutiple interactors collaborating?
Thanks!