You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Be able to mock the expect object class in the KMM project
Current Behavior
In my shared module, I created a use case class that uses the expected object class to do things like read and write files. But when I follow the guide book(https://notwoods.github.io/mockk-guidebook/docs/mocking/static/) to mock the read and write operations, according to the debug result, it does not seem to excute the result of my mock instead of excuting the real operation.
Steps to Reproduce
create an expect object class in common module and use case class
The part of the use case class:
class UseCase {
fun needToTest{
...
if(FileOperation.mvFile(scr,dest)){
...
}
...
}
}
The example file operation class:
expect object FileOperation {
fun rdFile(path: String): List<Path>?
fun mvFile(srcPath: String, destPath: String): Boolean?
....
}
android Part
actual object FileOperation {
......
actual fun mvFile(srcPath:String, destPath: String): Boolean? {
......
}
.......
}
Accoding to the debug results in my local, it doesn't seem to use the mock action I set up in the test function but instead does the real file operation.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are sure that this issue is important and should not be marked as stale just ask to put an important label.
Expected Behavior
Be able to mock the
expect object
class in the KMM projectCurrent Behavior
In my shared module, I created a use case class that uses the
expected object class
to do things like read and write files. But when I follow the guide book(https://notwoods.github.io/mockk-guidebook/docs/mocking/static/) to mock the read and write operations, according to the debug result, it does not seem to excute the result of my mock instead of excuting the real operation.Steps to Reproduce
The part of the use case class:
The example file operation class:
android Part
ios part
Context
The text was updated successfully, but these errors were encountered: