Skip to content

Commit 03bff3e

Browse files
committed
Add tests for Woo POS survey notification visibility flags
1 parent c3711d1 commit 03bff3e

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

WooCommerce/src/androidTest/kotlin/com/woocommerce/android/AppPrefsTest.kt

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import org.assertj.core.api.Assertions.assertThat
1010
import org.junit.Before
1111
import org.junit.Test
1212

13-
@Suppress("UnitTestNamingRule")
1413
class AppPrefsTest {
1514
@Before
1615
fun setup() {
@@ -593,4 +592,44 @@ class AppPrefsTest {
593592

594593
assertThat(AppPrefs.isPOSLaunchableForSite(siteId)).isFalse
595594
}
595+
596+
@Test
597+
fun givenWooPosSurveyNotificationCurrentUserShownNotSetThenReturnFalseByDefault() {
598+
assertThat(AppPrefs.isWooPosSurveyNotificationCurrentUserShown).isFalse
599+
}
600+
601+
@Test
602+
fun givenWooPosSurveyNotificationCurrentUserShownSetToTrueThenReturnTrue() {
603+
AppPrefs.isWooPosSurveyNotificationCurrentUserShown = true
604+
605+
assertThat(AppPrefs.isWooPosSurveyNotificationCurrentUserShown).isTrue
606+
}
607+
608+
@Test
609+
fun givenWooPosSurveyNotificationCurrentUserShownSetToFalseThenReturnFalse() {
610+
AppPrefs.isWooPosSurveyNotificationCurrentUserShown = true
611+
AppPrefs.isWooPosSurveyNotificationCurrentUserShown = false
612+
613+
assertThat(AppPrefs.isWooPosSurveyNotificationCurrentUserShown).isFalse
614+
}
615+
616+
@Test
617+
fun givenWooPosSurveyNotificationPotentialUserShownNotSetThenReturnFalseByDefault() {
618+
assertThat(AppPrefs.isWooPosSurveyNotificationPotentialUserShown).isFalse
619+
}
620+
621+
@Test
622+
fun givenWooPosSurveyNotificationPotentialUserShownSetToTrueThenReturnTrue() {
623+
AppPrefs.isWooPosSurveyNotificationPotentialUserShown = true
624+
625+
assertThat(AppPrefs.isWooPosSurveyNotificationPotentialUserShown).isTrue
626+
}
627+
628+
@Test
629+
fun givenWooPosSurveyNotificationPotentialUserShownSetToFalseThenReturnFalse() {
630+
AppPrefs.isWooPosSurveyNotificationPotentialUserShown = true
631+
AppPrefs.isWooPosSurveyNotificationPotentialUserShown = false
632+
633+
assertThat(AppPrefs.isWooPosSurveyNotificationPotentialUserShown).isFalse
634+
}
596635
}

0 commit comments

Comments
 (0)