hi everyone, has anyone tried to mock bluetooth in multiplatform for ios and android?
m
Max
04/14/2024, 7:25 PM
If it works on Android/ios, it will work on KMP! Just define an interface and provide the real implementations via koin. The sky is the limit;)
💯 1
🚀 1
s
Simon Buechner
04/14/2024, 7:31 PM
@Max i have a few problems there. i cannot mock bluetoothDevice/CBPeripheral, because i use a typealias that expects/actuals BluetoothDevice to those platform types. BluetoothDevice is a final class in android. I too cannot just start a bluetoothManager in a unit test. What do you mean by define an interface? Could you elaborate this a little more? At the moment i use koin in shared code and use it to mock things there in unit tests, but i want to test the whole bluetooth part without just defining functions that return sample data.
Maybe i just dont see what i should do and missing an easy road 😄 i would appreciate a little more info here
c
Chris Athanas
04/22/2024, 3:25 AM
I think Max meant you can build this out with KMP by using the
expected/actual
interfaces… I think he’s telling you it’s possible (it is) but that you will have to define the implementations from ios and android yourself. I don’t know of a unified library for that, but you may find one here:
https://iammohdzaki.github.io/KotLibs/