My tests are failing due to different object instances even though the side effects are same.
Expected :
[LoadingSideEffects$NavigateToLandingPage@4bc90c14]
Actual :
[LoadingSideEffects$NavigateToLandingPage@46a28b7f]
My side effect -:
class NavigateToLandingPage(val id:String) : LoadingSideEffects()
However when I try the same on side effects with no parameters, then the tests are passing e.g
object NavigateToLandingPage : LoadingSideEffects()
The latter will pass, however the former will fail.
For assertion, I am using
viewModel.assert(initialState = initialState) {
postedSideEffects(
LoadingSideEffects.NavigateToLandingPage(scheduleId)
)
}
This fails.
If I use,
val result = viewmodel.testIntent {
fetchStatus(id)
}
assert(result.sideEffectObserver.values.first() is LoadingSideEffects.NavigateToLandingPage)
This passes
Is this (result.sideEffectObserver.values.first()) the right way to test? And does it mean that we cannot use the format.
viewModel.assert(initialState = initialState) { }
when our side effect accepts some values/parameters?