Improve grouped and messaging notification capture
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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`() {
|
||||
|
||||
Reference in New Issue
Block a user