* fix(#206): read clarify.request question/choices from gateway The Hermes TUI gateway sends clarify.request payloads with "question" and "choices" fields, but the Android parser was looking for "text" and "options" — so the text was always null and the dialog showed only the input box. Fix reads "question"/"choices" first, falls back to "text"/"options" for backward compat. Test added for the new field names; existing test for legacy names still passes. * fix(#206): clear default text in clarify input field The input box was pre-filled with the clarify question text because the initial state was set to clarify.text instead of empty string. * fix: use JsonRpcResponse instead of undefined WsResponse in EventParserTest --------- Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
e7b2973c1c
commit
1bd56270b3
3 files changed
+35
-3
No files matched your search
@@ -173,6 +173,32 @@ class EventParserTest {
|
||||
assertEquals(listOf("Yes", "No"), clarifyEvent.options)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testParseClarifyRequest_withQuestionFields_parsesSuccessfully() {
|
||||
val response =
|
||||
JsonRpcResponse(
|
||||
jsonrpc = "2.0",
|
||||
id = null,
|
||||
result = null,
|
||||
error = null,
|
||||
method = "event",
|
||||
params =
|
||||
mapOf(
|
||||
"type" to "clarify.request",
|
||||
"payload" to
|
||||
mapOf(
|
||||
"question" to "Which environment?",
|
||||
"choices" to listOf("staging", "production"),
|
||||
),
|
||||
),
|
||||
)
|
||||
val event = EventParser.parse(response)
|
||||
assertTrue(event is WsEvent.ClarifyRequest)
|
||||
val clarifyEvent = event as WsEvent.ClarifyRequest
|
||||
assertEquals("Which environment?", clarifyEvent.text)
|
||||
assertEquals(listOf("staging", "production"), clarifyEvent.options)
|
||||
}
|
||||
|
||||
// ── TEST-07: Untested subtypes ─────────────────────────────────────
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user