Does anyone know how I can mock functions when writing unit tests?
g
gildor
07/01/2018, 4:46 PM
Mockk has some experimental support of mocking for Kotlin JS
http://mockk.io/
👍 1
gildor
07/01/2018, 4:47 PM
But why do you need this?
Usually it’s a bad sign if you want to mock top level function
v
Vivek
07/01/2018, 5:05 PM
If I have a class calling methods from another class, I don't care about the operations in that class, just the return values, shouldn't I be mocking the methods being called?
g
gildor
07/01/2018, 6:24 PM
But this is a mocking of methods, it’s not the same as mocking top level functions
v
Vivek
07/01/2018, 9:15 PM
Ah yes. Sorry, I was using the wrong terminology. I want to mock methods, not top level functions.