Hey guys, I'm trying to understand the difference ...
# orbit-mvi
b
Hey guys, I'm trying to understand the difference between
test()
and
liveTest()
From what I understand,
liveTest()
creates a real container host whereas
test()
creates a "fake" one. The
test()
function has an
isolateFlow
boolean, if set to
true
(default value) then it will only test 1 intent. If an intent is fired inside another intent, the 2nd intent won't run.
Copy code
containerHost.testIntent {
    change1()
    change2()
}
containerHost.assert(initialState) {
    states(
        {
            copy(...)
        },
        {
            copy(...)
        }
    )
}
If I run it with
test(isolateFlow = true)
or with
liveTest()
I get the same error "expected states but never received" But when I run it with
test(isolateFlow = false)
then my test passes Shouldn't be the opposite? Shouldn't
liveTest()
behave like
test(isolateFlow = false)
?
m
You are right - it should. Maybe something else is going on?
We don’t isolate flows in a live test
as it’s meant to be as close to the real thing as possible
b
I couldn't be bothered debug so I ended up just using
test()
just for this one 😅 But thanks for the info, that's useful