Fix tests
This commit is contained in:
parent
1a2b728361
commit
1cb27661c8
2 changed files with 5 additions and 4 deletions
|
|
@ -44,6 +44,7 @@ import io.element.android.libraries.textcomposer.model.VoiceMessageState
|
|||
import io.element.android.libraries.voicerecorder.test.FakeVoiceRecorder
|
||||
import io.element.android.services.analytics.test.FakeAnalyticsService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.collections.immutable.toPersistentList
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.test.TestScope
|
||||
import kotlinx.coroutines.test.runTest
|
||||
|
|
@ -66,7 +67,7 @@ class VoiceMessageComposerPresenterTest {
|
|||
|
||||
companion object {
|
||||
private val RECORDING_DURATION = 1.seconds
|
||||
private val RECORDING_STATE = VoiceMessageState.Recording(RECORDING_DURATION, 0.2f)
|
||||
private val RECORDING_STATE = VoiceMessageState.Recording(RECORDING_DURATION, listOf(0.1f, 0.2f).toPersistentList())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -145,7 +146,7 @@ class VoiceMessageComposerPresenterTest {
|
|||
}
|
||||
|
||||
// Nothing should happen
|
||||
assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Recording(RECORDING_DURATION, 0.2f))
|
||||
assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Recording(RECORDING_DURATION, RECORDING_STATE.levels))
|
||||
voiceRecorder.assertCalls(started = 1, stopped = 0, deleted = 0)
|
||||
|
||||
testPauseAndDestroy(finalState)
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ class FakeVoiceRecorder(
|
|||
curRecording = File("file.ogg")
|
||||
|
||||
timeSource += recordingDuration
|
||||
levels.forEach {
|
||||
_state.emit(VoiceRecorderState.Recording(startedAt.elapsedNow(), it))
|
||||
for(i in 1..levels.size) {
|
||||
_state.emit(VoiceRecorderState.Recording(startedAt.elapsedNow(), levels.take(i)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue