Unfortunately, I have another change request: it’s...
# orbit-mvi
o
Unfortunately, I have another change request: it’s about
runOnCreate
in tests -> it blocks, so if you have a delay or withTimeout call right when the container is created, your test would still be live timed 😞 https://github.com/orbit-mvi/orbit-mvi/pull/53
👍 1
the only thing to notice, is that it’s required
test()
to be a suspending function –> that’s breaking, but I guess as
testIntent
is suspending too, anyway, it doesn’t matter much ¯\_(ツ)_/¯
m
Food for thought - I think
runOnCreate
might be a bit hidden inside the
test
function anyway. How about moving it out into its own separate (suspending in suspending test mode, blocking in live test mode) function in
TestContainerHost
instead?
The
onCreate
lambda is not suspending, I suppose the only reason for it to be suspending is so it can run any fired off intents so it’s a bit of a weird one
o
@Mikolaj Leszczynski I like the idea to test
runOnCreate
with it’s own function, so it could look like
Copy code
createViewModel()
            .testOnCreate() // <-- ¯\_(ツ)_/¯ 
            .testIntent { onFilterClick() }
            .assert(initialState) {
                postedSideEffects(OffersEffect.NavigateToFilters)
            }
m
Makes sense to me, let's make it happen 🙂
Although I think you're missing a
test
At the beginning
o
yeah, sorry, it’s just our internal code style -> we hide test() call under the createViewModel() func
btw,
testOnCreate
or
runOnCreate
🤔
m
Test I guess
Although not so sure now 😜
o
because, u know, this func would not test anything, just invoke
okay, let me try
@Mikolaj Leszczynski I’ve updated the PR -> it’s ready for review
m
Cool, thanks. Will take a look when I have some spare time
👌 1
@Oleksii Malovanyi done
o
thanks! I’d better revert changes from the 1st commit first 😞 I’d update PR tmrw – I guess all comments are totally valid 👌
👍 1
@Mikolaj Leszczynski PR is ready for another round of review 😉
m
@Oleksii Malovanyi 👍 from me, I asked @appmattus to take another look
a
Approved and auto merge enabled
o
thanks for the quick feedback 🎉
any possible release date?
m
Yesterday 😂
4.1.0 but we haven't announced yet
👏 1
o
😲 omg
fyi: I’ve integrated the changes -> seems to be working flawlessly
👍 2