Choose manual profile over scheduled profile if active.

This commit is contained in:
Michelle Tang
2025-08-27 11:42:39 -04:00
parent 21363f085e
commit 8322bf3ecc
2 changed files with 3 additions and 7 deletions

View File

@@ -111,7 +111,7 @@ class NotificationProfilesTest {
}
@Test
fun `when first is scheduled and second is manually enabled forever before first's schedule start then return first`() {
fun `when first is scheduled and second is manually enabled forever before first's schedule start then return second`() {
every { notificationProfileValues.manuallyEnabledProfile } returns second.id
every { notificationProfileValues.manuallyEnabledUntil } returns Long.MAX_VALUE
every { notificationProfileValues.manuallyDisabledAt } returns sunday830am.toMillis(ZoneOffset.UTC)
@@ -119,7 +119,7 @@ class NotificationProfilesTest {
val schedule = NotificationProfileSchedule(id = 3L, true, start = 900, daysEnabled = setOf(DayOfWeek.SUNDAY))
val profiles = listOf(first.copy(schedule = schedule), second)
assertThat(NotificationProfiles.getActiveProfile(profiles, sunday930am.toMillis(ZoneOffset.UTC), utc), "active profile is first").isEqualTo(profiles[0])
assertThat(NotificationProfiles.getActiveProfile(profiles, sunday930am.toMillis(ZoneOffset.UTC), utc), "active profile is second").isEqualTo(profiles[1])
}
@Test