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
@@ -45,8 +45,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
// check if in the default state is not showing but is indeed loading
@@ -126,8 +126,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
// check if the banner is now in a loaded state and is showing the counter
@@ -187,8 +187,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
// check if the banner is now in a loaded state and is showing the counter
@@ -229,7 +229,7 @@ final class RoomScreenViewModelTests {
var configuration = JoinedRoomProxyMockConfiguration(id: "TestID", name: "StartingName", avatarURL: nil, hasOngoingCall: false)
let roomProxyMock = JoinedRoomProxyMock(configuration)
let powerLevelsMock = RoomPowerLevelsProxyMock(configuration: .init())
let powerLevelsMock = RoomPowerLevelsProxyMock(.init())
powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(false)
powerLevelsMock.canOwnUserJoinCallReturnValue = false
roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock)
@@ -246,8 +246,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
#expect(viewModel.state.roomTitle == "StartingName")
@@ -283,8 +283,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: ongoingCallRoomIDSubject.asCurrentValuePublisher(),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
#expect(viewModel.state.shouldShowCallButton)
@@ -328,8 +328,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
viewModel.stop()
}
@@ -349,8 +349,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
var deferred = deferFulfillment(viewModel.context.$viewState) { state in
@@ -383,8 +383,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
var deferred = deferFulfillment(viewModel.context.$viewState) { state in
@@ -412,8 +412,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
// Loading state just does not appear at all
@@ -432,8 +432,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
let deferred = deferFulfillment(viewModel.context.$viewState) { state in
@@ -459,8 +459,8 @@ final class RoomScreenViewModelTests {
ongoingCallRoomIDPublisher: .init(.init(nil)),
appSettings: appSettings,
appHooks: AppHooks(),
analyticsService: AnalyticsServiceMock.default,
userIndicatorController: UserIndicatorControllerMock.default)
analyticsService: AnalyticsServiceMock(.init()),
userIndicatorController: UserIndicatorControllerMock())
self.viewModel = viewModel
let deferredInvisible = deferFailure(viewModel.context.$viewState,