architecture-templates icon indicating copy to clipboard operation
architecture-templates copied to clipboard

Small fixes in MyModelViewModelTest

Open kworth opened this issue 1 year ago • 7 comments

As things are currently, the MyModelViewModelTest gives the impression of being a useful starting point, but ultimately leaves a lot to be desired. It has 2 tests with different names that have the same logic, and as soon as you go to update the second test to do what it says it does, the FakeMyModelRepository implementation doesn't act as one would reasonably expect (you can call addMyModel all you want, but still the only thing that was ever emitted was an empty list).

This PR aims to make the class more correct and helpful. Please see individual commits which should be self-explanatory.

kworth avatar Oct 31 '23 22:10 kworth

Thanks for your PR and thanks for the catch!

Why Unconfined and not StandardTestDispatcher?

JoseAlcerreca avatar Nov 02 '23 14:11 JoseAlcerreca

Good question. If Unconfined is not the right way to go, I'll fix that and keep that in mind in the future.

kworth avatar Nov 02 '23 17:11 kworth

Actually, it looks like the tests fail using StandardTestDispatcher, but it looks like what we should be using is in fact a third thing, UnconfinedTestDispatcher. @JoseAlcerreca good to merge now?

kworth avatar Nov 03 '23 11:11 kworth

@JoseAlcerreca any reason not to merge this in?

kworth avatar Nov 13 '23 17:11 kworth

Sorry, looking into it.

JoseAlcerreca avatar Nov 15 '23 17:11 JoseAlcerreca

Thanks, approved!

@kworth this needs to be replicated in the multimodule branch as well. Do you want to do it?

JoseAlcerreca avatar Nov 17 '23 15:11 JoseAlcerreca

Ah, good point. I think I should be able to make time for that. I haven't looked at that branch at all yet. Hopefully it's not too divergent and will be a quick cherry-pick.

kworth avatar Nov 17 '23 19:11 kworth