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 7ef09c52e..a5da610a3 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,9 @@ 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) - // TODO: Compiler is very confused about accessing the state.details for the PIN - // This test fails because of it - assertThat(state.details).isEqualTo(INITIAL_PIN_ELEMENT_STATE.details) + // 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 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 new file mode 100644 index 000000000..0e885e0b8 --- /dev/null +++ b/forage-android/src/test/java/com/joinforage/forage/android/core/element/state/ElementStateTest.kt @@ -0,0 +1,33 @@ +package com.joinforage.forage.android.core.element.state + +import org.assertj.core.api.Assertions.assertThat +import org.junit.Test + +class ElementStateTest { + + @Test + fun testInitialPinElementState() { + assertThat(INITIAL_PIN_ELEMENT_STATE.isFocused).isFalse + assertThat(INITIAL_PIN_ELEMENT_STATE.isBlurred).isTrue + assertThat(INITIAL_PIN_ELEMENT_STATE.isEmpty).isTrue + 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 + fun testInitialPanElementState() { + assertThat(INITIAL_PAN_ELEMENT_STATE.isFocused).isFalse + assertThat(INITIAL_PAN_ELEMENT_STATE.isBlurred).isTrue + assertThat(INITIAL_PAN_ELEMENT_STATE.isEmpty).isTrue + 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())) + } + +}