From fc407d93fd193dca6978513eeef072c00ae5cef1 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 19 Jun 2024 20:59:33 -0300 Subject: [PATCH] test: updated compose tests --- .../state/compose/ComposeValueManagerTest.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/compose/common/test/dev/programadorthi/state/compose/ComposeValueManagerTest.kt b/compose/common/test/dev/programadorthi/state/compose/ComposeValueManagerTest.kt index 3a75829..6a7f274 100644 --- a/compose/common/test/dev/programadorthi/state/compose/ComposeValueManagerTest.kt +++ b/compose/common/test/dev/programadorthi/state/compose/ComposeValueManagerTest.kt @@ -117,6 +117,7 @@ internal class ComposeValueManagerTest { fun shouldRegisterToRestoration() { val stateRestorationKey = "key#123" val stateRegistry = FakeSaveableStateRegistry() + val expectKey = "dev.programadorthi.state.compose.ComposeValueManagerState:$stateRestorationKey" composeValueManager( initialValue = 0, @@ -125,7 +126,7 @@ internal class ComposeValueManagerTest { ) assertEquals( - stateRestorationKey, + expectKey, stateRegistry.consumeRestoredKey, "Consuming different keys is wrong" ) @@ -141,7 +142,7 @@ internal class ComposeValueManagerTest { ) assertEquals( - "myName", + "dev.programadorthi.state.compose.ComposeValueManagerState:myName", stateRegistry.consumeRestoredKey, "Consuming different property keys is wrong" ) @@ -153,6 +154,7 @@ internal class ComposeValueManagerTest { fun shouldRegisterRestorationProvider() { val stateRestorationKey = "key#123" val stateRegistry = FakeSaveableStateRegistry() + val expectKey = "dev.programadorthi.state.compose.ComposeValueManagerState:$stateRestorationKey" stateRegistry.canBeSaved = true composeValueManager( @@ -162,13 +164,13 @@ internal class ComposeValueManagerTest { ) assertEquals( - stateRestorationKey, + expectKey, stateRegistry.consumeRestoredKey, "Consuming different keys is wrong" ) assertEquals(0, stateRegistry.canBeSavedValue, "Saved values are different") assertEquals( - stateRestorationKey, + expectKey, stateRegistry.entry?.key, "Registering providers with different keys" ) @@ -179,6 +181,7 @@ internal class ComposeValueManagerTest { fun shouldRestorePreviousValue() { val stateRestorationKey = "key#123" val stateRegistry = FakeSaveableStateRegistry() + val expectKey = "dev.programadorthi.state.compose.ComposeValueManagerState:$stateRestorationKey" stateRegistry.canBeSaved = true stateRegistry.consumeRestored = 2024 @@ -190,13 +193,13 @@ internal class ComposeValueManagerTest { assertEquals(2024, manager.value, "Value not restored correctly") assertEquals( - stateRestorationKey, + expectKey, stateRegistry.consumeRestoredKey, "Consuming different keys is wrong" ) assertEquals(2024, stateRegistry.canBeSavedValue, "Different can be saved values") assertEquals( - stateRestorationKey, + expectKey, stateRegistry.entry?.key, "Registering providers with different keys" )