feat(android): sync wake words via gateway

This commit is contained in:
Peter Steinberger
2025-12-14 05:05:30 +00:00
parent 0cef22ef83
commit d54cc49d66
6 changed files with 217 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
package com.steipete.clawdis.node
import org.junit.Assert.assertEquals
import org.junit.Test
class WakeWordsTest {
@Test
fun parseCommaSeparatedTrimsAndDropsEmpty() {
assertEquals(listOf("clawd", "claude"), WakeWords.parseCommaSeparated(" clawd , claude, , "))
}
@Test
fun sanitizeTrimsCapsAndFallsBack() {
val defaults = listOf("clawd", "claude")
val long = "x".repeat(WakeWords.maxWordLength + 10)
val words = listOf(" ", " hello ", long)
val sanitized = WakeWords.sanitize(words, defaults)
assertEquals(2, sanitized.size)
assertEquals("hello", sanitized[0])
assertEquals("x".repeat(WakeWords.maxWordLength), sanitized[1])
assertEquals(defaults, WakeWords.sanitize(listOf(" ", ""), defaults))
}
@Test
fun sanitizeLimitsWordCount() {
val defaults = listOf("clawd")
val words = (1..(WakeWords.maxWords + 5)).map { "w$it" }
val sanitized = WakeWords.sanitize(words, defaults)
assertEquals(WakeWords.maxWords, sanitized.size)
assertEquals("w1", sanitized.first())
assertEquals("w${WakeWords.maxWords}", sanitized.last())
}
}