element-hq / element-hq/element-x-android
Improve VoiceMessageComposerPresenterTest
- Dominant language
- Kotlin
- Stars
- 2.4k
- Forks
- 624
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 149
Description
For instance:
- `RECORDING_STATE` should be splitted into several intermediate states, because `FakeVoiceRecorder` emits all the states at the same time in the method `startRecord()`. A delay should be added [here](https://github.com/element-hq/element-x-android/blob/develop/libraries/voicerecorder/test/src/main/kotlin/io/element/android/libraries/voicerecorder/test/FakeVoiceRecorder.kt#L50).
- `FakeVoiceRecorder` could take some lambda in the constructor parameter to follow our current pattern. It coulde replace the method `FakeVoiceRecorder.assertCalls` and `FakeVoiceRecorder.givenThrowsSecurityException`
- Doing the change above makes some tests to fails, in particular `error("Previous recording was not cleared")` is invoked. This should be fixed, maybe `FakeVoiceRecorder` is a bit too clever?
Contributor guide
Research direction
Start with VoiceMessageComposerPresenterTest and the FakeVoiceRecorder implementation, especially startRecord(), assertCalls, and givenThrowsSecurityException. Separate the recorder states and consider constructor lambdas as described, then run the affected presenter tests and verify the previous-recording error is no longer triggered unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev, testing
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100