diff --git a/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/Unit/UserOtherSessionsViewModelTests.swift b/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/Unit/UserOtherSessionsViewModelTests.swift index 9b94979b2a..0a140203e9 100644 --- a/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/Unit/UserOtherSessionsViewModelTests.swift +++ b/RiotSwiftUI/Modules/UserSessions/UserOtherSessions/Test/Unit/UserOtherSessionsViewModelTests.swift @@ -62,7 +62,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: inactiveSectionHeader, emptyItemsTitle: VectorL10n.userOtherSessionNoInactiveSessions, allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -79,7 +80,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: allSectionHeader, emptyItemsTitle: "", allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -96,7 +98,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: unverifiedSectionHeader, emptyItemsTitle: VectorL10n.userOtherSessionNoUnverifiedSessions, allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -113,7 +116,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: verifiedSectionHeader, emptyItemsTitle: VectorL10n.userOtherSessionNoVerifiedSessions, allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -128,7 +132,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: verifiedSectionHeader, emptyItemsTitle: VectorL10n.userOtherSessionNoVerifiedSessions, allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -143,7 +148,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: unverifiedSectionHeader, emptyItemsTitle: VectorL10n.userOtherSessionNoUnverifiedSessions, allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -158,7 +164,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: inactiveSectionHeader, emptyItemsTitle: VectorL10n.userOtherSessionNoInactiveSessions, allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -178,7 +185,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: allSectionHeader, emptyItemsTitle: "", allItemsSelected: true, - enableSignOutButton: true) + enableSignOutButton: true, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -198,7 +206,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: allSectionHeader, emptyItemsTitle: "", allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -217,7 +226,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: allSectionHeader, emptyItemsTitle: "", allItemsSelected: false, - enableSignOutButton: true) + enableSignOutButton: true, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -236,7 +246,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: allSectionHeader, emptyItemsTitle: "", allItemsSelected: true, - enableSignOutButton: true) + enableSignOutButton: true, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -255,7 +266,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: allSectionHeader, emptyItemsTitle: "", allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -277,7 +289,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { header: allSectionHeader, emptyItemsTitle: "", allItemsSelected: false, - enableSignOutButton: false) + enableSignOutButton: false, + showLocationInfo: false) XCTAssertEqual(sut.state, expectedState) } @@ -332,7 +345,8 @@ class UserOtherSessionsViewModelTests: XCTestCase { title: String = "Title") -> UserOtherSessionsViewModel { UserOtherSessionsViewModel(sessionInfos: sessionInfos, filter: filter, - title: title) + title: title, + settingService: MockUserSessionSettings()) } private func createUserSessionInfo(sessionId: String, diff --git a/RiotSwiftUI/Modules/UserSessions/UserSessionOverview/Test/Unit/UserSessionOverviewViewModelTests.swift b/RiotSwiftUI/Modules/UserSessions/UserSessionOverview/Test/Unit/UserSessionOverviewViewModelTests.swift index 48d325db47..a6badfbd9c 100644 --- a/RiotSwiftUI/Modules/UserSessions/UserSessionOverview/Test/Unit/UserSessionOverviewViewModelTests.swift +++ b/RiotSwiftUI/Modules/UserSessions/UserSessionOverview/Test/Unit/UserSessionOverviewViewModelTests.swift @@ -22,7 +22,7 @@ import XCTest class UserSessionOverviewViewModelTests: XCTestCase { func test_whenVerifyCurrentSessionProcessed_completionWithVerifyCurrentSessionCalled() { let sessionInfo = createUserSessionInfo() - let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: MockUserSessionOverviewService()) + let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: MockUserSessionOverviewService(), settingsService: MockUserSessionSettings()) XCTAssertEqual(sut.state.isPusherEnabled, nil) var modelResult: UserSessionOverviewViewModelResult? @@ -35,7 +35,7 @@ class UserSessionOverviewViewModelTests: XCTestCase { func test_whenViewSessionDetailsProcessed_completionWithShowSessionDetailsCalled() { let sessionInfo = createUserSessionInfo() - let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: MockUserSessionOverviewService()) + let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: MockUserSessionOverviewService(), settingsService: MockUserSessionSettings()) XCTAssertEqual(sut.state.isPusherEnabled, nil) var modelResult: UserSessionOverviewViewModelResult? @@ -49,7 +49,7 @@ class UserSessionOverviewViewModelTests: XCTestCase { func test_whenViewSessionDetailsProcessed_toggleAvailablePusher() { let sessionInfo = createUserSessionInfo() let service = MockUserSessionOverviewService(pusherEnabled: true) - let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: service) + let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: service, settingsService: MockUserSessionSettings()) XCTAssertTrue(sut.state.remotelyTogglingPushersAvailable) XCTAssertEqual(sut.state.isPusherEnabled, true) @@ -62,7 +62,7 @@ class UserSessionOverviewViewModelTests: XCTestCase { func test_whenViewSessionDetailsProcessed_toggleNoPusher() { let sessionInfo = createUserSessionInfo() let service = MockUserSessionOverviewService(pusherEnabled: nil) - let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: service) + let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: service, settingsService: MockUserSessionSettings()) XCTAssertTrue(sut.state.remotelyTogglingPushersAvailable) XCTAssertEqual(sut.state.isPusherEnabled, nil) @@ -75,7 +75,7 @@ class UserSessionOverviewViewModelTests: XCTestCase { func test_whenViewSessionDetailsProcessed_remotelyTogglingPushersNotAvailable() { let sessionInfo = createUserSessionInfo() let service = MockUserSessionOverviewService(pusherEnabled: true, remotelyTogglingPushersAvailable: false) - let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: service) + let sut = UserSessionOverviewViewModel(sessionInfo: sessionInfo, service: service, settingsService: MockUserSessionSettings()) XCTAssertFalse(sut.state.remotelyTogglingPushersAvailable) XCTAssertEqual(sut.state.isPusherEnabled, true) diff --git a/RiotSwiftUI/Modules/UserSessions/UserSessionsOverview/Test/Unit/UserSessionsOverviewViewModelTests.swift b/RiotSwiftUI/Modules/UserSessions/UserSessionsOverview/Test/Unit/UserSessionsOverviewViewModelTests.swift index 30baea54d6..8ce396a6ec 100644 --- a/RiotSwiftUI/Modules/UserSessions/UserSessionsOverview/Test/Unit/UserSessionsOverviewViewModelTests.swift +++ b/RiotSwiftUI/Modules/UserSessions/UserSessionsOverview/Test/Unit/UserSessionsOverviewViewModelTests.swift @@ -21,7 +21,7 @@ import XCTest class UserSessionsOverviewViewModelTests: XCTestCase { func testInitialStateEmpty() { - let viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: MockUserSessionsOverviewService()) + let viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: MockUserSessionsOverviewService(), settingsService: MockUserSessionSettings()) XCTAssertNil(viewModel.state.currentSessionViewData) XCTAssertTrue(viewModel.state.unverifiedSessionsViewData.isEmpty) @@ -31,7 +31,7 @@ class UserSessionsOverviewViewModelTests: XCTestCase { } func testLoadOnDidAppear() { - let viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: MockUserSessionsOverviewService()) + let viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: MockUserSessionsOverviewService(), settingsService: MockUserSessionSettings()) viewModel.process(viewAction: .viewAppeared) XCTAssertNotNil(viewModel.state.currentSessionViewData) @@ -42,7 +42,7 @@ class UserSessionsOverviewViewModelTests: XCTestCase { } func testSimpleActionProcessing() { - let viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: MockUserSessionsOverviewService()) + let viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: MockUserSessionsOverviewService(), settingsService: MockUserSessionSettings()) var result: UserSessionsOverviewViewModelResult? viewModel.completion = { action in @@ -69,7 +69,7 @@ class UserSessionsOverviewViewModelTests: XCTestCase { let service = MockUserSessionsOverviewService() service.updateOverviewData { _ in } - let viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: service) + let viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: service, settingsService: MockUserSessionSettings()) var result: UserSessionsOverviewViewModelResult? viewModel.completion = { action in