Skip to content

Commit c647e7a

Browse files
committed
test(android): cover UTF-16 notification boundaries
1 parent 50ec031 commit c647e7a

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

apps/android/app/src/test/java/ai/openclaw/app/node/DeviceNotificationListenerServiceTest.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,4 @@ class DeviceNotificationListenerServiceTest {
128128
assertTrue(limiter.allow(nowEpochMs = nowEpochMs, maxEventsPerMinute = 2))
129129
assertFalse(limiter.allow(nowEpochMs = nowEpochMs, maxEventsPerMinute = 2))
130130
}
131-
132-
@Test
133-
fun sanitizeNotificationText_preservesUtf16BoundariesAtLimit() {
134-
val prefix = "a".repeat(511)
135-
val result = sanitizeNotificationText("$prefix🚀 trailing text")
136-
137-
assertEquals(prefix, result)
138-
}
139131
}

apps/android/app/src/test/java/ai/openclaw/app/node/NotificationsHandlerTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,18 @@ class NotificationsHandlerTest {
265265
assertTrue((sanitized ?: "").all { it == 'x' })
266266
}
267267

268+
@Test
269+
fun sanitizeNotificationTextPreservesUtf16BoundariesAtLimit() {
270+
val splitPairPrefix = "a".repeat(511)
271+
assertEquals(splitPairPrefix, sanitizeNotificationText("$splitPairPrefix🚀 trailing text"))
272+
273+
val completePairPrefix = "a".repeat(510)
274+
assertEquals(
275+
"$completePairPrefix🚀",
276+
sanitizeNotificationText("$completePairPrefix🚀 trailing text"),
277+
)
278+
}
279+
268280
@Test
269281
fun notificationsActionClearablePolicy_onlyRequiresClearableForDismiss() {
270282
assertTrue(actionRequiresClearableNotification(NotificationActionKind.Dismiss))

0 commit comments

Comments
 (0)