Koin嘲笑暂停功能

问题描述 投票:0回答:1

任何人都可以告诉我是否/如何通过koin测试来模拟一个暂停功能?到目前为止,我唯一知道的就是这种行为

declareMock<...> {
      given(..)).willReturn(...)
   }

但是在suspend fun()上不起作用。有什么与Mockk中的'coEvery'类似,或者我该怎么做?

预先感谢,

狼人

testing koin
1个回答
0
投票
var preferenceRepository = mockk<PreferenceRepository>() @Before fun before() { startKoin { androidContext(ApplicationProvider.getApplicationContext()) } declare { factory { preferenceRepository } } }
© www.soinside.com 2019 - 2024. All rights reserved.