mirror of https://github.com/openclaw/openclaw.git
test: cover android sms send dispatch gating
This commit is contained in:
parent
a58ff25769
commit
403cf9070e
|
|
@ -118,6 +118,34 @@ class InvokeDispatcherTest {
|
|||
assertEquals("SMS_UNAVAILABLE: SMS not available on this device", result.error?.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleInvoke_allowsAvailableSmsSendToReachHandler() =
|
||||
runTest {
|
||||
val result =
|
||||
newDispatcher(
|
||||
sendSmsAvailable = true,
|
||||
smsFeatureEnabled = true,
|
||||
smsTelephonyAvailable = true,
|
||||
).handleInvoke(OpenClawSmsCommand.Send.rawValue, """{"to":"+15551234567","message":"hi"}""")
|
||||
|
||||
assertEquals("SMS_PERMISSION_REQUIRED", result.error?.code)
|
||||
assertEquals("grant SMS permission", result.error?.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleInvoke_blocksSmsSendWhenUnavailable() =
|
||||
runTest {
|
||||
val result =
|
||||
newDispatcher(
|
||||
sendSmsAvailable = false,
|
||||
smsFeatureEnabled = true,
|
||||
smsTelephonyAvailable = true,
|
||||
).handleInvoke(OpenClawSmsCommand.Send.rawValue, """{"to":"+15551234567","message":"hi"}""")
|
||||
|
||||
assertEquals("SMS_UNAVAILABLE", result.error?.code)
|
||||
assertEquals("SMS_UNAVAILABLE: SMS not available on this device", result.error?.message)
|
||||
}
|
||||
|
||||
private fun newDispatcher(
|
||||
sendSmsAvailable: Boolean = false,
|
||||
readSmsAvailable: Boolean = false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue