mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-31 04:03:59 +03:00
Fix broken test
This commit is contained in:
parent
dcd43d6e7f
commit
8bf46b136a
3 changed files with 41 additions and 5 deletions
|
@ -22,6 +22,7 @@ import im.vector.app.features.session.coroutineScope
|
|||
import im.vector.app.features.settings.devices.v2.notification.UpdateNotificationSettingsAccountDataUseCase
|
||||
import im.vector.app.test.fakes.FakeContext
|
||||
import im.vector.app.test.fakes.FakeNotificationsSettingUpdater
|
||||
import im.vector.app.test.fakes.FakePushRulesUpdater
|
||||
import im.vector.app.test.fakes.FakeSession
|
||||
import im.vector.app.test.fakes.FakeVectorPreferences
|
||||
import im.vector.app.test.fakes.FakeWebRtcCallManager
|
||||
|
@ -47,6 +48,7 @@ class ConfigureAndStartSessionUseCaseTest {
|
|||
private val fakeUpdateMatrixClientInfoUseCase = mockk<UpdateMatrixClientInfoUseCase>()
|
||||
private val fakeVectorPreferences = FakeVectorPreferences()
|
||||
private val fakeNotificationsSettingUpdater = FakeNotificationsSettingUpdater()
|
||||
private val fakePushRulesUpdater = FakePushRulesUpdater()
|
||||
private val fakeUpdateNotificationSettingsAccountDataUseCase = mockk<UpdateNotificationSettingsAccountDataUseCase>()
|
||||
|
||||
private val configureAndStartSessionUseCase = ConfigureAndStartSessionUseCase(
|
||||
|
@ -56,7 +58,7 @@ class ConfigureAndStartSessionUseCaseTest {
|
|||
vectorPreferences = fakeVectorPreferences.instance,
|
||||
notificationsSettingUpdater = fakeNotificationsSettingUpdater.instance,
|
||||
updateNotificationSettingsAccountDataUseCase = fakeUpdateNotificationSettingsAccountDataUseCase,
|
||||
pushRulesUpdater = mockk(),
|
||||
pushRulesUpdater = fakePushRulesUpdater.instance,
|
||||
)
|
||||
|
||||
@Before
|
||||
|
@ -79,7 +81,8 @@ class ConfigureAndStartSessionUseCaseTest {
|
|||
coJustRun { fakeUpdateMatrixClientInfoUseCase.execute(any()) }
|
||||
coJustRun { fakeUpdateNotificationSettingsAccountDataUseCase.execute(any()) }
|
||||
fakeVectorPreferences.givenIsClientInfoRecordingEnabled(isEnabled = true)
|
||||
fakeNotificationsSettingUpdater.givenOnSessionsStarted(aSession)
|
||||
fakeNotificationsSettingUpdater.givenOnSessionStarted(aSession)
|
||||
fakePushRulesUpdater.givenOnSessionStarted(aSession)
|
||||
|
||||
// When
|
||||
configureAndStartSessionUseCase.execute(aSession, startSyncing = true)
|
||||
|
@ -103,7 +106,8 @@ class ConfigureAndStartSessionUseCaseTest {
|
|||
fakeWebRtcCallManager.givenCheckForProtocolsSupportIfNeededSucceeds()
|
||||
coJustRun { fakeUpdateNotificationSettingsAccountDataUseCase.execute(any()) }
|
||||
fakeVectorPreferences.givenIsClientInfoRecordingEnabled(isEnabled = false)
|
||||
fakeNotificationsSettingUpdater.givenOnSessionsStarted(aSession)
|
||||
fakeNotificationsSettingUpdater.givenOnSessionStarted(aSession)
|
||||
fakePushRulesUpdater.givenOnSessionStarted(aSession)
|
||||
|
||||
// When
|
||||
configureAndStartSessionUseCase.execute(aSession, startSyncing = true)
|
||||
|
@ -130,7 +134,8 @@ class ConfigureAndStartSessionUseCaseTest {
|
|||
coJustRun { fakeUpdateMatrixClientInfoUseCase.execute(any()) }
|
||||
coJustRun { fakeUpdateNotificationSettingsAccountDataUseCase.execute(any()) }
|
||||
fakeVectorPreferences.givenIsClientInfoRecordingEnabled(isEnabled = true)
|
||||
fakeNotificationsSettingUpdater.givenOnSessionsStarted(aSession)
|
||||
fakeNotificationsSettingUpdater.givenOnSessionStarted(aSession)
|
||||
fakePushRulesUpdater.givenOnSessionStarted(aSession)
|
||||
|
||||
// When
|
||||
configureAndStartSessionUseCase.execute(aSession, startSyncing = false)
|
||||
|
|
|
@ -25,7 +25,7 @@ class FakeNotificationsSettingUpdater {
|
|||
|
||||
val instance = mockk<NotificationsSettingUpdater>()
|
||||
|
||||
fun givenOnSessionsStarted(session: Session) {
|
||||
fun givenOnSessionStarted(session: Session) {
|
||||
justRun { instance.onSessionStarted(session) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.test.fakes
|
||||
|
||||
import im.vector.app.core.notification.PushRulesUpdater
|
||||
import io.mockk.justRun
|
||||
import io.mockk.mockk
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
|
||||
class FakePushRulesUpdater {
|
||||
|
||||
val instance = mockk<PushRulesUpdater>()
|
||||
|
||||
fun givenOnSessionStarted(session: Session) {
|
||||
justRun { instance.onSessionStarted(session) }
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue