mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Pin create: add test for presenter
This commit is contained in:
@@ -32,6 +32,16 @@ suspend fun <T : Any> ReceiveTurbine<T>.consumeItemsUntilTimeout(timeout: Durati
|
||||
return consumeItemsUntilPredicate(timeout) { false }
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume all items which are emitted sequentially.
|
||||
* Use the smallest timeout possible internally to avoid wasting time.
|
||||
* Same as calling skipItems(x) and then awaitItem() but without assumption on the number of items.
|
||||
* @return the last item emitted.
|
||||
*/
|
||||
suspend fun <T : Any> ReceiveTurbine<T>.awaitLastSequentialItem(): T {
|
||||
return consumeItemsUntilTimeout(1.milliseconds).last()
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume items until predicate is true, or timeout is reached waiting for an event, or we receive terminal event.
|
||||
* The timeout is applied for each event.
|
||||
|
||||
Reference in New Issue
Block a user