Skip to content

test: add component integration tests#79

Merged
chrisuthe merged 3 commits intomainfrom
integration-tests-component-interactions
Mar 8, 2026
Merged

test: add component integration tests#79
chrisuthe merged 3 commits intomainfrom
integration-tests-component-interactions

Conversation

@chrisuthe
Copy link
Copy Markdown
Owner

Summary

  • PlaybackServiceConnectionLifecycleTest: Verifies connectToServer state machine transitions (Disconnected -> Connecting -> Connected/Error), callback bridging, and disconnect flag propagation
  • StreamStartDecoderPipelineTest: Verifies onStreamStart creates correct decoder pipeline (primary + PCM fallback) and SyncAudioPlayer creation parameters
  • AudioFocusHandlingTest: Verifies AUDIOFOCUS_LOSS/TRANSIENT/GAIN/DUCK handling matches PlaybackService.handleAudioFocusChange behavior
  • MaAutoConnectTokenTest: Verifies MusicAssistantManager.onServerConnected decision flow for token auth, NeedsAuth, and Unavailable states
  • MaDataChannelTransportLifecycleTest: Verifies REMOTE mode eagerly creates DataChannel transport with buffered message replay
  • NsdDiscoveryRepositoryIntegrationTest: Verifies mDNS discovery callbacks correctly add/remove servers in UnifiedServerRepository
  • AutoReconnectNetworkSwitchTest: Verifies network change triggers reconnect with debouncing, cancel resets state, and backoff constants
  • BrowseTreeTest: Verifies Android Auto browse tree root items and server list based on MA availability and connection state
  • MetadataMediaSessionChainTest: Verifies end-to-end metadata flow from updateMetadata through ForwardingPlayer to MediaSession listeners

Test plan

  • All 9 test classes pass locally via ./gradlew testDebugUnitTest
  • Tests use MockK for Android framework mocking (consistent with existing tests)
  • No Android emulator required -- all tests run on JVM
  • Tests are placed in the same package structure as existing tests
  • No changes to production code

…e, and audio focus

- PlaybackServiceConnectionLifecycleTest: verifies connectToServer state transitions,
  callback interface bridging, and disconnect flag propagation
- StreamStartDecoderPipelineTest: verifies onStreamStart creates correct decoder
  pipeline with fallback, and SyncAudioPlayer creation parameters
- AudioFocusHandlingTest: verifies AUDIOFOCUS_LOSS/TRANSIENT/GAIN handling
  matches PlaybackService.handleAudioFocusChange behavior
… and NSD discovery

- MaAutoConnectTokenTest: verifies onServerConnected decision flow for auto-connecting
  with stored token, NeedsAuth when no token, and Unavailable for non-MA servers
- MaDataChannelTransportLifecycleTest: verifies REMOTE mode creates and consumes
  DataChannel transport eagerly, with buffered message replay
- NsdDiscoveryRepositoryIntegrationTest: verifies mDNS discovery callbacks
  correctly add/remove servers in UnifiedServerRepository
…chain

- AutoReconnectNetworkSwitchTest: verifies network change triggers reconnect
  with debouncing, cancel resets state, and backoff constants are consistent
- BrowseTreeTest: verifies Android Auto browse tree returns correct root items
  based on MA availability, server list ordering, and media ID formatting
- MetadataMediaSessionChainTest: verifies end-to-end metadata flow from
  updateMetadata through ForwardingPlayer to MediaSession listeners
@chrisuthe chrisuthe merged commit 4df2a40 into main Mar 8, 2026
@chrisuthe chrisuthe deleted the integration-tests-component-interactions branch March 12, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant