Generating SDK Mocks through the usage of swift run tools generate-sdk-mocks (#982)

* basic implementation, that works for now only with the local SDK

* replaced a handmade mock with a generated mock
This commit is contained in:
Mauro
2023-05-30 09:48:55 +02:00
committed by GitHub
parent 25e2b05a4a
commit 088ca622a1
39 changed files with 857 additions and 194 deletions
@@ -21,12 +21,12 @@ struct CreateRoomCoordinatorParameters {
let userSession: UserSessionProtocol
weak var userIndicatorController: UserIndicatorControllerProtocol?
let createRoomParameters: CurrentValuePublisher<CreateRoomFlowParameters, Never>
let selectedUsers: CurrentValuePublisher<[UserProfile], Never>
let selectedUsers: CurrentValuePublisher<[UserProfileProxy], Never>
}
enum CreateRoomCoordinatorAction {
case openRoom(withIdentifier: String)
case deselectUser(UserProfile)
case deselectUser(UserProfileProxy)
case updateDetails(CreateRoomFlowParameters)
}
@@ -23,12 +23,12 @@ enum CreateRoomScreenErrorType: Error {
enum CreateRoomViewModelAction {
case openRoom(withIdentifier: String)
case deselectUser(UserProfile)
case deselectUser(UserProfileProxy)
case updateDetails(CreateRoomFlowParameters)
}
struct CreateRoomViewState: BindableState {
var selectedUsers: [UserProfile]
var selectedUsers: [UserProfileProxy]
var bindings: CreateRoomViewStateBindings
var canCreateRoom: Bool {
@@ -47,5 +47,5 @@ struct CreateRoomViewStateBindings {
enum CreateRoomViewAction {
case createRoom
case deselectUser(UserProfile)
case deselectUser(UserProfileProxy)
}
@@ -32,7 +32,7 @@ class CreateRoomViewModel: CreateRoomViewModelType, CreateRoomViewModelProtocol
init(userSession: UserSessionProtocol,
userIndicatorController: UserIndicatorControllerProtocol?,
createRoomParameters: CurrentValuePublisher<CreateRoomFlowParameters, Never>,
selectedUsers: CurrentValuePublisher<[UserProfile], Never>) {
selectedUsers: CurrentValuePublisher<[UserProfileProxy], Never>) {
let parameters = createRoomParameters.value
self.userSession = userSession
self.userIndicatorController = userIndicatorController
@@ -164,7 +164,7 @@ struct CreateRoom_Previews: PreviewProvider {
let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "@userid:example.com"),
mediaProvider: MockMediaProvider())
let parameters = CreateRoomFlowParameters()
let selectedUsers: [UserProfile] = [.mockAlice, .mockBob, .mockCharlie]
let selectedUsers: [UserProfileProxy] = [.mockAlice, .mockBob, .mockCharlie]
return CreateRoomViewModel(userSession: userSession, userIndicatorController: nil, createRoomParameters: .init(parameters), selectedUsers: .init(selectedUsers))
}()