Skip to content

Commit

Permalink
Fix IDE warnings in SurveyTypeTest
Browse files Browse the repository at this point in the history
  • Loading branch information
irfano committed Jan 16, 2025
1 parent 70c5af3 commit 1adf8b6
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ import org.junit.Test
class SurveyTypeTest {
@Test
fun `SurveyType url should include platform tag for any URL`() {
assertThat(SurveyType.values()).allSatisfy {
assertThat(SurveyType.entries.toTypedArray()).allSatisfy {
assertThat(it.url.contains("woo-mobile-platform=android")).isTrue()
}
}

@Test
fun `Product SurveyType url should include a milestone tag`() {
assertThat(PRODUCT.url.contains(Regex("product-milestone=$anyDigitAndNothingAfter"))).isTrue()
assertThat(PRODUCT.url.contains(Regex("product-milestone=$ANY_DIGIT_AND_NOTHING_AFTER"))).isTrue()
}

@Test
fun `Main SurveyType url should NOT include a milestone tag`() {
assertThat(MAIN.url.contains(Regex("milestone=$anyDigitAndNothingAfter"))).isFalse()
assertThat(MAIN.url.contains(Regex("milestone=$ANY_DIGIT_AND_NOTHING_AFTER"))).isFalse()
}

@Test
fun `SurveyType url should include app version form tag for any URL`() {
assertThat(SurveyType.values()).allSatisfy {
assertThat(SurveyType.entries.toTypedArray()).allSatisfy {
assertThat(it.url.contains("app-version=${BuildConfig.VERSION_NAME}")).isTrue()
}
}

companion object {
const val anyDigitAndNothingAfter = "\\d(?!\\S)"
const val ANY_DIGIT_AND_NOTHING_AFTER = "\\d(?!\\S)"
}
}

0 comments on commit 1adf8b6

Please sign in to comment.