test(notifications): add unit tests for reply/markAsRead/reaction receivers

Adds Robolectric-based androidHostTest coverage for the three notification
BroadcastReceivers. Verifies:

- ReplyReceiver sends a DataPacket derived from the contactKey then calls
  appendOutgoingMessage followed by markConversationRead in that order.
- MarkAsReadReceiver invokes markConversationRead, ignores wrong actions,
  and drops intents missing the contact key.
- ReactionReceiver dispatches a ServiceAction.Reaction and, on success,
  calls markConversationRead. Failures in dispatch short-circuit markRead.

Uses the existing FakeRadioController and FakeMeshServiceNotifications
(marked open so tests can record calls) plus mokkery for ServiceRepository,
mirroring the pattern in SendMessageWorkerTest. Fakes are wired through a
per-test Koin graph to match each receiver's KoinComponent injection.

Also fixes a pre-existing compile break in MeshServiceNotificationsImplTest
that was missing the shortcutManager constructor argument.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich 2026-04-17 09:50:52 -05:00
parent dac4880e0f
commit 1d258daded
6 changed files with 386 additions and 2 deletions

View file

@ -24,7 +24,7 @@ import org.meshtastic.proto.Telemetry
/** A test double for [MeshServiceNotifications] that provides a no-op implementation. */
@Suppress("TooManyFunctions", "EmptyFunctionBlock")
class FakeMeshServiceNotifications : MeshServiceNotifications {
open class FakeMeshServiceNotifications : MeshServiceNotifications {
override fun clearNotifications() {}
override fun initChannels() {}

View file

@ -31,7 +31,7 @@ import org.meshtastic.proto.User
* A test double for [RadioController] that provides a no-op implementation and tracks calls for assertions in tests.
*/
@Suppress("TooManyFunctions", "EmptyFunctionBlock")
class FakeRadioController :
open class FakeRadioController :
BaseFake(),
RadioController {