Hello everyone! I have an `expect/actual` like thi...
# multiplatform
s
Hello everyone! I have an
expect/actual
like this:
Copy code
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:
Copy code
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.
Copy code
service.showView(compoment = [???])
How could I achieve this? Thanks!
r
you can use as PlatformUIComponent to whatever component you want to pass
s
Unfortunately, this resolved in a casting exception. I tried having a
expect fun getTestPlatform(): PlatformUIComponent
that does sound promising BUT I can't get to initialize a
FragmentActivity
or to mock one