Improve grouped and messaging notification capture

This commit is contained in:
ajp_anton
2026-07-27 12:03:33 +00:00
parent 4d84ff98c7
commit 3dc87b417a
8 changed files with 79 additions and 3 deletions
@@ -0,0 +1,26 @@
package se.ajpanton.notificationlog.capture
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class GroupSummaryPolicyTest {
private fun snapshot(isGroupSummary: Boolean) = NotificationSnapshot(
key = "key",
packageName = "example.app",
textContents = null,
hasImage = false,
isGroupSummary = isGroupSummary,
isRoutine = false,
imageBytes = null,
)
@Test fun `group summaries are logged by default`() {
assertTrue(GroupSummaryPolicy.shouldLog(snapshot(isGroupSummary = true), logGroupSummaries = true))
}
@Test fun `disabled group summaries are skipped without affecting children`() {
assertFalse(GroupSummaryPolicy.shouldLog(snapshot(isGroupSummary = true), logGroupSummaries = false))
assertTrue(GroupSummaryPolicy.shouldLog(snapshot(isGroupSummary = false), logGroupSummaries = false))
}
}
@@ -7,7 +7,7 @@ import org.junit.Test
class NotificationChangeClassifierTest {
private fun snapshot(text: String, routine: Boolean = false) = NotificationSnapshot(
key = "key", packageName = "example.app", textContents = text, hasImage = false,
isRoutine = routine, imageBytes = null,
isGroupSummary = false, isRoutine = routine, imageBytes = null,
)
@Test fun `text change is an edit`() {