mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Tidy up mock creation. (#5627)
* Use our standard XYZMock(.init()) pattern everywhere instead of XYZMock.default. * Remove the configuration parameter label on mock convenience inits. * Update the enterprise submodule.
This commit is contained in:
@@ -30,8 +30,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
notificationSettingsProxyMock = NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration())
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -43,8 +43,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", members: mockedMembers, joinRule: .public))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -63,8 +63,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -84,8 +84,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -142,8 +142,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: true, isEncrypted: true, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -163,8 +163,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: true, isEncrypted: true, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -194,8 +194,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: true, isEncrypted: true, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -224,8 +224,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: true, isEncrypted: true, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -255,8 +255,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: true, isEncrypted: true, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -287,8 +287,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
powerLevelsConfiguration: .init(canUserInvite: false)))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -304,8 +304,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", members: mockedMembers, joinRule: .public))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -341,7 +341,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
|
||||
roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(configuration: .init())
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init())
|
||||
powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in
|
||||
.success(event == .roomAvatar)
|
||||
}
|
||||
@@ -356,8 +356,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -380,7 +380,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
|
||||
roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(configuration: .init())
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init())
|
||||
powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in
|
||||
.success(event == .roomName)
|
||||
}
|
||||
@@ -395,8 +395,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -419,7 +419,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
|
||||
roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(configuration: .init())
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init())
|
||||
powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in
|
||||
.success(event == .roomTopic)
|
||||
}
|
||||
@@ -434,8 +434,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -454,8 +454,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: false, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -474,8 +474,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: true, members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -492,8 +492,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(msg: "error")
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -700,8 +700,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: false, knockRequestsState: .loaded(mockedRequests), joinRule: .knock))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -721,8 +721,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: false, knockRequestsState: .loading, joinRule: .knock))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -744,8 +744,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
powerLevelsConfiguration: .init(canUserInvite: false)))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -767,8 +767,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", isDirect: true, members: mockedMembers, knockRequestsState: .loaded(mockedRequests), joinRule: .knock))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
@@ -794,8 +794,8 @@ struct RoomDetailsScreenViewModelTests {
|
||||
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: AnalyticsServiceMock.default,
|
||||
userIndicatorController: UserIndicatorControllerMock.default,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
|
||||
Reference in New Issue
Block a user