Fix tests

Otherwise following error was thrown:

Expected com.nextcloud.talk.viewmodels.CallRecordingViewModel$RecordingStartingState@5f78de22 but encountered com.nextcloud.talk.viewmodels.CallRecordingViewModel$RecordingStartingState@516ebdf8
com.vividsolutions.jts.util.AssertionFailedException: Expected com.nextcloud.talk.viewmodels.CallRecordingViewModel$RecordingStartingState@5f78de22 but encountered com.nextcloud.talk.viewmodels.CallRecordingViewModel$RecordingStartingState@516ebdf8
	at app//com.vividsolutions.jts.util.Assert.equals(Assert.java:100)
	at app//com.vividsolutions.jts.util.Assert.equals(Assert.java:85)
	at app//com.nextcloud.talk.viewmodels.CallRecordingViewModelTest.testCallRecordingViewModel_clickStartRecord(CallRecordingViewModelTest.kt:25)
	at java.base@11.0.15/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-02-22 13:17:34 +01:00
parent 499e022114
commit 5284cb35dd
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -21,15 +21,12 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
viewModel.setData("foo")
viewModel.clickRecordButton()
Assert.equals(CallRecordingViewModel.RecordingStartingState(true), viewModel.viewState.value)
Assert.isTrue(viewModel.viewState.value is CallRecordingViewModel.RecordingStartingState)
// fake to execute setRecordingState which would be triggered by signaling message
viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE)
Assert.equals(
CallRecordingViewModel.RecordingStartedState(true).javaClass,
viewModel.viewState.value?.javaClass
)
Assert.isTrue(viewModel.viewState.value is CallRecordingViewModel.RecordingStartedState)
}
@Test
@ -42,11 +39,11 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
viewModel.clickRecordButton()
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
Assert.isTrue(viewModel.viewState.value is CallRecordingViewModel.RecordingConfirmStopState)
viewModel.stopRecording()
Assert.equals(CallRecordingViewModel.RecordingStoppedState, viewModel.viewState.value)
Assert.isTrue(viewModel.viewState.value is CallRecordingViewModel.RecordingStoppedState)
}
@Test
@ -59,11 +56,11 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
viewModel.clickRecordButton()
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
Assert.isTrue(viewModel.viewState.value is CallRecordingViewModel.RecordingConfirmStopState)
viewModel.clickRecordButton()
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
Assert.isTrue(viewModel.viewState.value is CallRecordingViewModel.RecordingConfirmStopState)
}
@Test
@ -73,14 +70,12 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE)
viewModel.clickRecordButton()
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
Assert.isTrue(viewModel.viewState.value is CallRecordingViewModel.RecordingConfirmStopState)
viewModel.dismissStopRecording()
Assert.equals(
CallRecordingViewModel.RecordingStartedState(true, false).javaClass,
viewModel.viewState.value?.javaClass
)
Assert.isTrue(viewModel.viewState.value is CallRecordingViewModel.RecordingStartedState)
Assert.equals(
false,
(viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo