Thunks now get helper functions (getWeb3Wrapper, getContractWrappers, etc.) from the extra (third) argument. This makes them more testable.
A side-effect of this is that now all thunks are typed: you'll see that the ThunkCreator signature was added to all of them. But this means that dispatch is smarter now, and it detects floating promises. I added a bunch of comments ignoring this error. I think this is good, though: those floating promises come from places where thunks are too tightly coupled. We can improve this later with some middleware that dispatches certain thunks when certain events happen.
I also added some tests to have as examples. They need to mock a lot of stuff, and might be a little too white-box, but it's a start.
This is an alternative to #333.
Thunks now get helper functions (
getWeb3Wrapper
,getContractWrappers
, etc.) from the extra (third) argument. This makes them more testable.A side-effect of this is that now all thunks are typed: you'll see that the
ThunkCreator
signature was added to all of them. But this means thatdispatch
is smarter now, and it detects floating promises. I added a bunch of comments ignoring this error. I think this is good, though: those floating promises come from places where thunks are too tightly coupled. We can improve this later with some middleware that dispatches certain thunks when certain events happen.I also added some tests to have as examples. They need to mock a lot of stuff, and might be a little too white-box, but it's a start.