mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Fix ui tests that use the composer draft service (#2956)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Copyright 2024 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.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct ComposerDraftServiceMockConfiguration {
|
||||
var draft: ComposerDraftProxy?
|
||||
}
|
||||
|
||||
extension ComposerDraftServiceMock {
|
||||
convenience init(_ config: ComposerDraftServiceMockConfiguration) {
|
||||
self.init()
|
||||
loadDraftReturnValue = .success(config.draft)
|
||||
saveDraftReturnValue = .success(())
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -274,7 +274,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -291,7 +291,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -308,7 +308,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
@@ -328,7 +328,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -348,7 +348,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -368,7 +368,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -389,7 +389,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -409,7 +409,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -428,7 +428,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
|
||||
@@ -461,7 +461,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -481,7 +481,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
@@ -501,7 +501,7 @@ class MockScreen: Identifiable {
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
composerDraftService: ComposerDraftServiceMock(.init()))
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
|
||||
Reference in New Issue
Block a user