Sebastien Leclerc Lavallee
05/07/2025, 3:39 AMexpect/actual
like this:
expect class PlatformUIComponent
// Android
actual typealias PlatformUIComponent = FragmentActivity
// iOS
actual typealias PlatformUIComponent = UIViewController
And I have a service in common code that use that class:
class SomeService {
fun showView(component: PlatformUIComponent)
}
I want to test that function. When I try to call that function in my test, I don't see how to pass an instance of the expected class.
service.showView(compoment = [???])
How could I achieve this?
Thanks!Rohit
05/07/2025, 11:30 AMSebastien Leclerc Lavallee
05/07/2025, 4:07 PMexpect fun getTestPlatform(): PlatformUIComponent
that does sound promising BUT I can't get to initialize a FragmentActivity
or to mock one