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:
Doug
2026-05-22 17:34:35 +01:00
committed by GitHub
parent edd7130a97
commit 08d02001bf
146 changed files with 540 additions and 546 deletions
@@ -225,8 +225,8 @@ struct HomeScreen_Previews: PreviewProvider, TestablePreview {
return HomeScreenViewModel(userSession: userSession,
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: .volatile(),
analyticsService: AnalyticsServiceMock.default,
analyticsService: AnalyticsServiceMock(.init()),
notificationManager: NotificationManagerMock(),
userIndicatorController: UserIndicatorControllerMock.default)
userIndicatorController: UserIndicatorControllerMock())
}
}
@@ -146,8 +146,8 @@ struct HomeScreenEmptyStateView_Previews: PreviewProvider, TestablePreview {
return HomeScreenViewModel(userSession: userSession,
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: .volatile(),
analyticsService: AnalyticsServiceMock.default,
analyticsService: AnalyticsServiceMock(.init()),
notificationManager: NotificationManagerMock(),
userIndicatorController: UserIndicatorControllerMock.default)
userIndicatorController: UserIndicatorControllerMock())
}()
}
@@ -203,9 +203,9 @@ struct HomeScreenInviteCell_Previews: PreviewProvider, TestablePreview {
return HomeScreenViewModel(userSession: userSession,
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: .volatile(),
analyticsService: AnalyticsServiceMock.default,
analyticsService: AnalyticsServiceMock(.init()),
notificationManager: NotificationManagerMock(),
userIndicatorController: UserIndicatorControllerMock.default)
userIndicatorController: UserIndicatorControllerMock())
}
}
@@ -135,9 +135,9 @@ struct HomeScreenKnockedCell_Previews: PreviewProvider, TestablePreview {
return HomeScreenViewModel(userSession: userSession,
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: .volatile(),
analyticsService: AnalyticsServiceMock.default,
analyticsService: AnalyticsServiceMock(.init()),
notificationManager: NotificationManagerMock(),
userIndicatorController: UserIndicatorControllerMock.default)
userIndicatorController: UserIndicatorControllerMock())
}
}
@@ -124,8 +124,8 @@ struct HomeScreenRecoveryKeyConfirmationBanner_Previews: PreviewProvider, Testab
return HomeScreenViewModel(userSession: userSession,
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: .volatile(),
analyticsService: AnalyticsServiceMock.default,
analyticsService: AnalyticsServiceMock(.init()),
notificationManager: NotificationManagerMock(),
userIndicatorController: UserIndicatorControllerMock.default)
userIndicatorController: UserIndicatorControllerMock())
}
}
@@ -221,17 +221,17 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
VStack(spacing: 0) {
ForEach(genericRooms) { room in
HomeScreenRoomCell(room: room, isSelected: false, mediaProvider: MediaProviderMock(configuration: .init())) { _ in }
HomeScreenRoomCell(room: room, isSelected: false, mediaProvider: MediaProviderMock(.init())) { _ in }
}
HomeScreenRoomCell(room: .placeholder(), isSelected: false, mediaProvider: MediaProviderMock(configuration: .init())) { _ in }
HomeScreenRoomCell(room: .placeholder(), isSelected: false, mediaProvider: MediaProviderMock(.init())) { _ in }
.redacted(reason: .placeholder)
}
.previewDisplayName("Generic")
VStack(spacing: 0) {
ForEach(notificationsStateRooms) { room in
HomeScreenRoomCell(room: room, isSelected: false, mediaProvider: MediaProviderMock(configuration: .init())) { _ in }
HomeScreenRoomCell(room: room, isSelected: false, mediaProvider: MediaProviderMock(.init())) { _ in }
}
}
.previewLayout(.sizeThatFits)
@@ -239,7 +239,7 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
VStack(spacing: 0) {
ForEach(lastMessageStateRooms) { room in
HomeScreenRoomCell(room: room, isSelected: false, mediaProvider: MediaProviderMock(configuration: .init())) { _ in }
HomeScreenRoomCell(room: room, isSelected: false, mediaProvider: MediaProviderMock(.init())) { _ in }
}
}
.previewLayout(.sizeThatFits)
@@ -256,9 +256,9 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
return HomeScreenViewModel(userSession: userSession,
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: .volatile(),
analyticsService: AnalyticsServiceMock.default,
analyticsService: AnalyticsServiceMock(.init()),
notificationManager: NotificationManagerMock(),
userIndicatorController: UserIndicatorControllerMock.default)
userIndicatorController: UserIndicatorControllerMock())
}
static func makeRoom(lastMessageState: RoomSummary.LastMessageState) -> HomeScreenRoom {