Fix repeat rule tests

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

@ -4,11 +4,13 @@ import dagger.hilt.android.testing.HiltAndroidTest
import dagger.hilt.android.testing.UninstallModules import dagger.hilt.android.testing.UninstallModules
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.tasks.Freeze
import org.tasks.TestUtilities.withTZ import org.tasks.TestUtilities.withTZ
import org.tasks.analytics.Firebase import org.tasks.analytics.Firebase
import org.tasks.injection.InjectingTestCase import org.tasks.injection.InjectingTestCase
import org.tasks.injection.ProductionModule import org.tasks.injection.ProductionModule
import org.tasks.locale.Locale import org.tasks.locale.Locale
import org.tasks.time.DateTime
import java.text.ParseException import java.text.ParseException
import java.util.* import java.util.*
import javax.inject.Inject import javax.inject.Inject
@ -80,31 +82,37 @@ class RepeatRuleToStringTest : InjectingTestCase() {
@Test @Test
fun repeatUntilPositiveOffset() { fun repeatUntilPositiveOffset() {
withTZ(BERLIN) { Freeze.freezeAt(DateTime(2021, 1, 4)) {
assertEquals( withTZ(BERLIN) {
assertEquals(
"Repeats daily until February 23", "Repeats daily until February 23",
toString("RRULE:FREQ=DAILY;UNTIL=20210223;INTERVAL=1") toString("RRULE:FREQ=DAILY;UNTIL=20210223;INTERVAL=1")
) )
}
} }
} }
@Test @Test
fun repeatUntilNoOffset() { fun repeatUntilNoOffset() {
withTZ(LONDON) { Freeze.freezeAt(DateTime(2021, 1, 4)) {
assertEquals( withTZ(LONDON) {
assertEquals(
"Repeats daily until February 23", "Repeats daily until February 23",
toString("RRULE:FREQ=DAILY;UNTIL=20210223;INTERVAL=1") toString("RRULE:FREQ=DAILY;UNTIL=20210223;INTERVAL=1")
) )
}
} }
} }
@Test @Test
fun repeatUntilNegativeOffset() { fun repeatUntilNegativeOffset() {
withTZ(NEW_YORK) { Freeze.freezeAt(DateTime(2021, 1, 4)) {
assertEquals( withTZ(NEW_YORK) {
assertEquals(
"Repeats daily until February 23", "Repeats daily until February 23",
toString("RRULE:FREQ=DAILY;UNTIL=20210223;INTERVAL=1") toString("RRULE:FREQ=DAILY;UNTIL=20210223;INTERVAL=1")
) )
}
} }
} }

Loading…
Cancel
Save