From 852d38c82b12fa95b9a61239b936c4104521fabd Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Tue, 11 Jan 2022 16:28:51 +0100 Subject: [PATCH] Refactor DomSideEffectTests: use assertContentEquals for comparing lists --- .../src/jsTest/kotlin/DomSideEffectTests.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/web/core/src/jsTest/kotlin/DomSideEffectTests.kt b/web/core/src/jsTest/kotlin/DomSideEffectTests.kt index 27b47920bc..b5e291ea16 100644 --- a/web/core/src/jsTest/kotlin/DomSideEffectTests.kt +++ b/web/core/src/jsTest/kotlin/DomSideEffectTests.kt @@ -7,6 +7,7 @@ import kotlinx.browser.document import kotlinx.dom.clear import org.jetbrains.compose.web.testutils.* import kotlin.test.Test +import kotlin.test.assertContentEquals import kotlin.test.assertEquals class DomSideEffectTests { @@ -107,7 +108,7 @@ class DomSideEffectTests { @Test fun sideEffectsOrder() = runTest { - var effectsList = mutableListOf() + val effectsList = mutableListOf() var key = 1 var recomposeScope: RecomposeScope? = null @@ -126,19 +127,19 @@ class DomSideEffectTests { } } - assertEquals(2, effectsList.size) - assertEquals("DisposableRefEffect", effectsList[0]) - assertEquals("DomSideEffect", effectsList[1]) + assertContentEquals( + listOf("DisposableRefEffect", "DomSideEffect"), + effectsList + ) key = 2 recomposeScope?.invalidate() waitForRecompositionComplete() - assertEquals(4, effectsList.size) - assertEquals("DisposableRefEffect", effectsList[0]) - assertEquals("DomSideEffect", effectsList[1]) - assertEquals("DisposableRefEffect", effectsList[2]) - assertEquals("DomSideEffect", effectsList[3]) + assertContentEquals( + listOf("DisposableRefEffect", "DomSideEffect", "DisposableRefEffect", "DomSideEffect"), + effectsList + ) } }