From 8ed83f1ad40549255121fe5e3201d27cf8847b6f Mon Sep 17 00:00:00 2001 From: Devin Morgan Date: Tue, 5 Dec 2023 09:36:17 -0500 Subject: [PATCH] Fix tests --- .../android/core/element/state/ElementState.kt | 4 ++-- .../core/element/state/ElementStateManagerTest.kt | 13 ++----------- .../android/core/element/state/ElementStateTest.kt | 6 +----- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/forage-android/src/main/java/com/joinforage/forage/android/core/element/state/ElementState.kt b/forage-android/src/main/java/com/joinforage/forage/android/core/element/state/ElementState.kt index ce6be400..e6efe05a 100644 --- a/forage-android/src/main/java/com/joinforage/forage/android/core/element/state/ElementState.kt +++ b/forage-android/src/main/java/com/joinforage/forage/android/core/element/state/ElementState.kt @@ -27,7 +27,7 @@ internal val INITIAL_PIN_ELEMENT_STATE = PinElementStateDto( isFocused = false, isBlurred = true, isEmpty = true, - isValid = true, + isValid = false, isComplete = false, validationError = null ) @@ -58,7 +58,7 @@ internal val INITIAL_PAN_ELEMENT_STATE = PanElementStateDto( isFocused = false, isBlurred = true, isEmpty = true, - isValid = false, + isValid = true, isComplete = false, validationError = null, derivedCardInfo = DerivedCardInfoDto() diff --git a/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateManagerTest.kt b/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateManagerTest.kt index a5da610a..0f8677b9 100644 --- a/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateManagerTest.kt +++ b/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateManagerTest.kt @@ -16,9 +16,6 @@ class ElementStateManagerTest { assertThat(state.isValid).isEqualTo(INITIAL_PIN_ELEMENT_STATE.isValid) assertThat(state.isComplete).isEqualTo(INITIAL_PIN_ELEMENT_STATE.isComplete) assertThat(state.validationError).isEqualTo(INITIAL_PIN_ELEMENT_STATE.validationError) - // cast to Any? to avoid ambiguous overload issue that - // is unique to PinDetails because it's an alias for `Nothing?` - assertThat(state.details as Any?).isEqualTo(INITIAL_PIN_ELEMENT_STATE.details) } @Test @@ -113,10 +110,7 @@ class ElementStateManagerTest { assertThat(state.isEmpty).isEqualTo(INITIAL_PAN_ELEMENT_STATE.isEmpty) assertThat(state.isValid).isEqualTo(INITIAL_PAN_ELEMENT_STATE.isValid) assertThat(state.isComplete).isEqualTo(INITIAL_PAN_ELEMENT_STATE.isComplete) - - // cast to Any? to avoid ambiguous overload issue that - // is unique to PinDetails because it's an alias for `Nothing?` - assertThat(state.details as Any?).isEqualTo(INITIAL_PAN_ELEMENT_STATE.details) + assertThat(state.derivedCardInfo).isEqualTo(INITIAL_PAN_ELEMENT_STATE.derivedCardInfo) // unfocus manager.changeFocus(false) @@ -126,9 +120,6 @@ class ElementStateManagerTest { assertThat(state.isEmpty).isEqualTo(INITIAL_PAN_ELEMENT_STATE.isEmpty) assertThat(state.isValid).isEqualTo(INITIAL_PAN_ELEMENT_STATE.isValid) assertThat(state.isComplete).isEqualTo(INITIAL_PAN_ELEMENT_STATE.isComplete) - - // cast to Any? to avoid ambiguous overload issue that - // is unique to PinDetails because it's an alias for `Nothing?` - assertThat(state.details as Any?).isEqualTo(INITIAL_PAN_ELEMENT_STATE.details) + assertThat(state.derivedCardInfo).isEqualTo(INITIAL_PAN_ELEMENT_STATE.derivedCardInfo) } } diff --git a/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateTest.kt b/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateTest.kt index afce6efc..f230678d 100644 --- a/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateTest.kt +++ b/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateTest.kt @@ -13,10 +13,6 @@ class ElementStateTest { assertThat(INITIAL_PIN_ELEMENT_STATE.isValid).isFalse assertThat(INITIAL_PIN_ELEMENT_STATE.isComplete).isFalse assertThat(INITIAL_PIN_ELEMENT_STATE.validationError).isNull() - - // cast to Any? to avoid ambiguous overload issue that - // is unique to PinDetails because it's an alias for `Nothing?` - assertThat(INITIAL_PIN_ELEMENT_STATE.details as Any?).isNull() } @Test @@ -27,6 +23,6 @@ class ElementStateTest { assertThat(INITIAL_PAN_ELEMENT_STATE.isValid).isTrue assertThat(INITIAL_PAN_ELEMENT_STATE.isComplete).isFalse assertThat(INITIAL_PAN_ELEMENT_STATE.validationError).isNull() - assertThat(INITIAL_PAN_ELEMENT_STATE.details).isEqualTo(PanDetails(DerivedCardInfo())) + assertThat(INITIAL_PAN_ELEMENT_STATE.derivedCardInfo).isEqualTo(DerivedCardInfoDto()) } }