Stop notification listener when all logging is disabled

This commit is contained in:
ajp_anton
2026-07-23 14:02:58 +00:00
parent 6ce7d65409
commit 50aebbd42b
5 changed files with 75 additions and 1 deletions
@@ -0,0 +1,15 @@
package se.ajpanton.notificationlog.settings
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class NotificationListenerPolicyTest {
@Test fun `listener runs when any logging type is enabled`() {
assertTrue(NotificationListenerPolicy.shouldRun(listOf(LoggingRule(enabled = false), LoggingRule(enabled = true))))
}
@Test fun `listener stays off when every logging type is disabled`() {
assertFalse(NotificationListenerPolicy.shouldRun(LoggingType.entries.map { LoggingRule(enabled = false) }))
}
}