How are people working with SKIE flows from unit t...
# touchlab-tools
t
How are people working with SKIE flows from unit tests written in Swift? For example:
final class FakeDoAnOptionalThingFlow: DoAnOptionalThingFlow {
var flow: SkieSwiftMutableSharedFlow<SomeState?>
init() {
flow = SkieSwiftMutableSharedFlow<SomeState?>()
}
func invoke() -> SkieSwiftOptionalFlow<SomeState> {
flow
}
func emit(_ value: SomeState) async {
try await flow.emit(value)
}
}
final class FakeDoAnotherThingFlow: DoAnotherThingFlow {
var flow: SkieSwiftMutableSharedFlow<KotlinBoolean>
init() {
flow = SkieSwiftMutableSharedFlow<KotlinBoolean>()
}
func invoke() -> SkieSwiftFlow<KotlinBoolean> {
flow as SkieSwiftFlow<KotlinBoolean>
}
func emit(_ value: KotlinBoolean) async {
try await flow.emit(value)
}
}
In both cases I need a mutable flow I can emit changes through and in both cases I’m not sure how to return the expected type defined in the invoke method. Any tips?