mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 20:01:55 +00:00
Warmup molecule only once.
This commit is contained in:
@@ -33,8 +33,16 @@ import kotlin.time.Duration.Companion.seconds
|
|||||||
* inside runTest which has a short default timeout.
|
* inside runTest which has a short default timeout.
|
||||||
*/
|
*/
|
||||||
class WarmUpRule : TestRule {
|
class WarmUpRule : TestRule {
|
||||||
override fun apply(base: Statement, description: Description): Statement = object: Statement() {
|
companion object {
|
||||||
override fun evaluate() {
|
init {
|
||||||
|
warmUpMolecule()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun apply(base: Statement, description: Description): Statement = base
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun warmUpMolecule() {
|
||||||
runTest(timeout = 60.seconds) {
|
runTest(timeout = 60.seconds) {
|
||||||
moleculeFlow(RecompositionMode.Immediate) {
|
moleculeFlow(RecompositionMode.Immediate) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
@@ -42,7 +50,4 @@ class WarmUpRule: TestRule {
|
|||||||
awaitItem() // Await a Unit composition
|
awaitItem() // Await a Unit composition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
base.evaluate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user