Fix repeat rule tests

pull/1742/merge
Alex Baker 2 years ago
parent 7a365167c8
commit d2dddb9dbc

@ -4,11 +4,13 @@ import dagger.hilt.android.testing.HiltAndroidTest
import dagger.hilt.android.testing.UninstallModules
import org.junit.Assert.assertEquals
import org.junit.Test
import org.tasks.Freeze
import org.tasks.TestUtilities.withTZ
import org.tasks.analytics.Firebase
import org.tasks.injection.InjectingTestCase
import org.tasks.injection.ProductionModule
import org.tasks.locale.Locale
import org.tasks.time.DateTime
import java.text.ParseException
import java.util.*
import javax.inject.Inject
@ -80,6 +82,7 @@ class RepeatRuleToStringTest : InjectingTestCase() {
@Test
fun repeatUntilPositiveOffset() {
Freeze.freezeAt(DateTime(2021, 1, 4)) {
withTZ(BERLIN) {
assertEquals(
"Repeats daily until February 23",
@ -87,9 +90,11 @@ class RepeatRuleToStringTest : InjectingTestCase() {
)
}
}
}
@Test
fun repeatUntilNoOffset() {
Freeze.freezeAt(DateTime(2021, 1, 4)) {
withTZ(LONDON) {
assertEquals(
"Repeats daily until February 23",
@ -97,9 +102,11 @@ class RepeatRuleToStringTest : InjectingTestCase() {
)
}
}
}
@Test
fun repeatUntilNegativeOffset() {
Freeze.freezeAt(DateTime(2021, 1, 4)) {
withTZ(NEW_YORK) {
assertEquals(
"Repeats daily until February 23",
@ -107,6 +114,7 @@ class RepeatRuleToStringTest : InjectingTestCase() {
)
}
}
}
private fun toString(rrule: String): String? {
return toString(null, rrule)

Loading…
Cancel
Save