Has anyone successfully used a unit testing mockin...
# multiplatform
j
Has anyone successfully used a unit testing mocking library that works well with MPP? Looking for one.
k
mockk. though frankly I found it to only handle basic use cases
j
Can you give a little more detail about what works with mockk? Do spies and class mocks work?
k
to some degree. I recommend you take the time to investigate it.
m
It looks like it doesn't support ios mocks at all (and maybe struggles with js tests?) https://github.com/mockk/mockk/issues/58
k
hmm, for some reason I had in my head that it supported k/n
a
There is no mocking in kn currently, AFAIK. I switched completely to fakes, even in pure Android projects. I recommend this article: https://medium.com/@june.pravin/mocking-is-not-practical-use-fakes-e30cc6eaaf4e
k
Personally, I prefer to use DI/SL to swap out test implementations. It seems to work fairly well.
k
@Arkadii Ivanov by any chance, do you have a project sample with testing using fakes?
a
@Kurt Renzo Acosta nothing open at the moment. But there is nothing special. Just abstract dependencies with interfaces and provide test implementations that simulate real ones. Interface segregation principle and functional interfaces really help here.
k
Great! Looking forward to it. We have some fakes at the moment but I feel like we could do better
👍 1