mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Periphery cleanup (#5893)
This commit is contained in:
@@ -12,7 +12,6 @@ import Testing
|
||||
|
||||
struct AttributedStringBuilderTests {
|
||||
private let attributedStringBuilder: AttributedStringBuilder
|
||||
private let maxHeaderPointSize = ceil(UIFont.preferredFont(forTextStyle: .body).pointSize * 1.2)
|
||||
|
||||
init() async throws {
|
||||
attributedStringBuilder = AttributedStringBuilder(mentionBuilder: MentionBuilder())
|
||||
|
||||
@@ -30,7 +30,6 @@ struct AudioPlayerStateTests {
|
||||
audioPlayerMock.state = .stopped
|
||||
audioPlayerMock.currentTime = 0.0
|
||||
audioPlayerMock.duration = 0.0
|
||||
audioPlayerMock.playbackSpeed = 1.0
|
||||
audioPlayerMock.seekToClosure = { [audioPlayerSeekCallsSubject] progress in
|
||||
audioPlayerSeekCallsSubject?.send(progress)
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ struct ChatsTabFlowCoordinatorTests {
|
||||
var notificationManager: NotificationManagerMock!
|
||||
let stateMachineFactory = PublishedStateMachineFactory()
|
||||
|
||||
var cancellables = Set<AnyCancellable>()
|
||||
|
||||
var detailCoordinator: CoordinatorProtocol? {
|
||||
splitCoordinator.detailCoordinator
|
||||
}
|
||||
@@ -53,8 +51,7 @@ struct ChatsTabFlowCoordinatorTests {
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationManager: notificationManager,
|
||||
stateMachineFactory: stateMachineFactory)
|
||||
chatsTabFlowCoordinator = ChatsTabFlowCoordinator(isNewLogin: false,
|
||||
navigationSplitCoordinator: splitCoordinator,
|
||||
chatsTabFlowCoordinator = ChatsTabFlowCoordinator(navigationSplitCoordinator: splitCoordinator,
|
||||
flowParameters: flowParameters)
|
||||
|
||||
let deferred = deferFulfillment(stateMachineFactory.chatsTabFlowStatePublisher) { $0 == .roomList(detailState: nil) }
|
||||
|
||||
@@ -19,8 +19,6 @@ final class CreateRoomScreenViewModelTests {
|
||||
|
||||
private let appSettings: AppSettings
|
||||
|
||||
private let usersSubject = CurrentValueSubject<[UserProfile], Never>([])
|
||||
|
||||
var context: CreateRoomScreenViewModel.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
@@ -170,8 +170,7 @@ final class InviteUsersScreenViewModelTests {
|
||||
roomType: .draft(mandatoryInvitees: [.mockAlice]),
|
||||
isSkippable: false,
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
appSettings: .volatile())
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
|
||||
// The locked invitee starts pre-selected and locked.
|
||||
#expect(context.viewState.selectedUsers.map(\.id) == [UserProfile.mockAlice.id])
|
||||
@@ -235,8 +234,7 @@ final class InviteUsersScreenViewModelTests {
|
||||
roomType: .existingRoom(roomProxy: roomProxy),
|
||||
isSkippable: isSkippable,
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
appSettings: .volatile())
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
viewModel.state.usersSection = .init(type: .suggestions, users: [.mockAlice, .mockBob, .mockCharlie])
|
||||
self.viewModel = viewModel
|
||||
}
|
||||
|
||||
@@ -14,10 +14,6 @@ import Testing
|
||||
|
||||
@MainActor
|
||||
final class LoggingTests {
|
||||
private enum Constants {
|
||||
static let genericFailure = "Test failed"
|
||||
}
|
||||
|
||||
deinit {
|
||||
Tracing.logsDirectoryOverride = nil
|
||||
do {
|
||||
|
||||
@@ -246,7 +246,6 @@ struct LoginScreenViewModelTests {
|
||||
viewModel = LoginScreenViewModel(authenticationService: service,
|
||||
loginHint: loginHint,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
appSettings: appSettings,
|
||||
analytics: AnalyticsServiceMock(.init()))
|
||||
appSettings: appSettings)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,6 @@ import Testing
|
||||
struct MediaPlayerProviderTests {
|
||||
private var mediaPlayerProvider: MediaPlayerProvider
|
||||
|
||||
private let oggMimeType = "audio/ogg"
|
||||
private let someURL = URL.mockMXCAudio
|
||||
private let someOtherURL = URL.mockMXCFile
|
||||
|
||||
init() async {
|
||||
mediaPlayerProvider = MediaPlayerProvider()
|
||||
}
|
||||
@@ -41,7 +37,6 @@ struct MediaPlayerProviderTests {
|
||||
func detachAllStates() {
|
||||
let audioPlayer = AudioPlayerMock()
|
||||
audioPlayer.actions = PassthroughSubject<AudioPlayerAction, Never>().eraseToAnyPublisher()
|
||||
audioPlayer.playbackSpeed = 1.0
|
||||
|
||||
let audioPlayerStates = Array(repeating: AudioPlayerState(id: .timelineItemIdentifier(.randomEvent), title: "", duration: 0), count: 10)
|
||||
for audioPlayerState in audioPlayerStates {
|
||||
@@ -62,7 +57,6 @@ struct MediaPlayerProviderTests {
|
||||
func detachAllStatesWithException() {
|
||||
let audioPlayer = AudioPlayerMock()
|
||||
audioPlayer.actions = PassthroughSubject<AudioPlayerAction, Never>().eraseToAnyPublisher()
|
||||
audioPlayer.playbackSpeed = 1.0
|
||||
|
||||
let audioPlayerStates = Array(repeating: AudioPlayerState(id: .timelineItemIdentifier(.randomEvent), title: "", duration: 0), count: 10)
|
||||
for audioPlayerState in audioPlayerStates {
|
||||
|
||||
@@ -292,7 +292,6 @@ final class MediaUploadPreviewScreenViewModelTests {
|
||||
viewModel = MediaUploadPreviewScreenViewModel(mediaURLs: urls,
|
||||
caption: nil,
|
||||
title: "Some File",
|
||||
isRoomEncrypted: true,
|
||||
shouldShowCaptionWarning: true,
|
||||
mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: appSettings),
|
||||
timelineController: TimelineControllerMock(.init(timelineProxy: timelineProxy)),
|
||||
|
||||
@@ -157,6 +157,7 @@ struct SessionV1: Equatable {
|
||||
}
|
||||
|
||||
enum SlidingSyncVersionV1: Equatable {
|
||||
// periphery:ignore - documents a structure the app used to write
|
||||
case none
|
||||
case proxy(url: String)
|
||||
case native
|
||||
|
||||
@@ -33,8 +33,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -46,8 +45,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
let deferred = deferFulfillment(context.observe(\.viewState.bindings.leaveRoomAlertItem)) { $0 != nil }
|
||||
|
||||
context.send(viewAction: .processTapLeave)
|
||||
@@ -66,8 +64,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
let deferred = deferFulfillment(context.observe(\.viewState.bindings.leaveRoomAlertItem)) { $0 != nil }
|
||||
|
||||
context.send(viewAction: .processTapLeave)
|
||||
@@ -87,8 +84,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
context.send(viewAction: .processTapLeave)
|
||||
#expect(context.leaveRoomAlertItem?.state == .empty)
|
||||
@@ -145,8 +141,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferred = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil }
|
||||
|
||||
@@ -166,8 +161,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferredRecipient = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil }
|
||||
|
||||
@@ -198,8 +192,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferredRecipient = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil }
|
||||
|
||||
@@ -229,8 +222,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferredRecipient = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil }
|
||||
|
||||
@@ -261,8 +253,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferredRecipient = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil }
|
||||
|
||||
@@ -294,8 +285,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
_ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first()
|
||||
|
||||
@@ -311,8 +301,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
_ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first()
|
||||
|
||||
@@ -346,13 +335,9 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init())
|
||||
powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in
|
||||
.success(event == .roomAvatar)
|
||||
}
|
||||
powerLevelsProxyMock.canOwnUserSendStateEventClosure = { event in
|
||||
event == .roomAvatar
|
||||
}
|
||||
roomProxyMock.powerLevelsReturnValue = .success(powerLevelsProxyMock)
|
||||
|
||||
let roomInfoProxyMock = RoomInfoProxyMock(configuration)
|
||||
roomInfoProxyMock.powerLevels = powerLevelsProxyMock
|
||||
@@ -363,8 +348,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
_ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first()
|
||||
|
||||
@@ -385,13 +369,9 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init())
|
||||
powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in
|
||||
.success(event == .roomName)
|
||||
}
|
||||
powerLevelsProxyMock.canOwnUserSendStateEventClosure = { event in
|
||||
event == .roomName
|
||||
}
|
||||
roomProxyMock.powerLevelsReturnValue = .success(powerLevelsProxyMock)
|
||||
|
||||
let roomInfoProxyMock = RoomInfoProxyMock(configuration)
|
||||
roomInfoProxyMock.powerLevels = powerLevelsProxyMock
|
||||
@@ -402,8 +382,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
_ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first()
|
||||
|
||||
@@ -424,13 +403,9 @@ struct RoomDetailsScreenViewModelTests {
|
||||
roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init())
|
||||
powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in
|
||||
.success(event == .roomTopic)
|
||||
}
|
||||
powerLevelsProxyMock.canOwnUserSendStateEventClosure = { event in
|
||||
event == .roomTopic
|
||||
}
|
||||
roomProxyMock.powerLevelsReturnValue = .success(powerLevelsProxyMock)
|
||||
|
||||
let roomInfoProxyMock = RoomInfoProxyMock(configuration)
|
||||
roomInfoProxyMock.powerLevels = powerLevelsProxyMock
|
||||
@@ -441,8 +416,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
_ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first()
|
||||
|
||||
@@ -461,8 +435,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
_ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first()
|
||||
|
||||
@@ -481,8 +454,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
_ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first()
|
||||
|
||||
@@ -499,8 +471,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
var deferred = deferFulfillment(context.observe(\.viewState.notificationSettingsState)) { $0.isError }
|
||||
|
||||
@@ -707,8 +678,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferred = deferFulfillment(context.observe(\.viewState)) { state in
|
||||
state.knockRequestsCount == 2 && state.canSeeKnockingRequests
|
||||
@@ -728,8 +698,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferred = deferFulfillment(context.observe(\.viewState)) { state in
|
||||
state.knockRequestsCount == 0 && state.canSeeKnockingRequests
|
||||
@@ -751,8 +720,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferred = deferFulfillment(context.observe(\.viewState)) { state in
|
||||
state.knockRequestsCount == 2 &&
|
||||
@@ -774,8 +742,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferred = deferFulfillment(context.observe(\.viewState)) { state in
|
||||
state.knockRequestsCount == 2 &&
|
||||
@@ -801,8 +768,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
|
||||
let deferredShared = deferFulfillment(context.observe(\.viewState),
|
||||
message: "The pill should be shown for rooms with shared history visibility") { state in
|
||||
|
||||
@@ -471,10 +471,6 @@ final class RoomFlowCoordinatorTests {
|
||||
try await processRouteOrClear(route: nil, expectedActions: expectedActions)
|
||||
}
|
||||
|
||||
private func process(route: AppRoute, expectedActions: [RoomFlowCoordinatorAction]) async throws {
|
||||
try await processRouteOrClear(route: route, expectedActions: expectedActions)
|
||||
}
|
||||
|
||||
private func processRouteOrClear(route: AppRoute?, expectedActions: [RoomFlowCoordinatorAction]) async throws {
|
||||
guard !expectedActions.isEmpty else {
|
||||
return
|
||||
|
||||
@@ -11,7 +11,6 @@ import Testing
|
||||
|
||||
@MainActor
|
||||
struct RoomMemberDetailsViewModelTests {
|
||||
var clientProxy: ClientProxy!
|
||||
var viewModel: RoomMemberDetailsScreenViewModelProtocol!
|
||||
var roomProxyMock: JoinedRoomProxyMock!
|
||||
var roomMemberProxyMock: RoomMemberProxyMock!
|
||||
@@ -212,7 +211,6 @@ struct RoomMemberDetailsViewModelTests {
|
||||
roomProxy: roomProxyMock,
|
||||
userSession: userSession,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
analytics: AnalyticsServiceMock(.init()),
|
||||
appSettings: .volatile())
|
||||
analytics: AnalyticsServiceMock(.init()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ import Testing
|
||||
|
||||
@MainActor
|
||||
final class RoomScreenViewModelTests {
|
||||
private var viewModel: RoomScreenViewModel!
|
||||
|
||||
private let appSettings: AppSettings
|
||||
|
||||
init() async throws {
|
||||
@@ -47,7 +45,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
// check if in the default state is not showing but is indeed loading
|
||||
var deferred = deferFulfillment(viewModel.context.$viewState) { viewState in
|
||||
@@ -128,7 +125,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
// check if the banner is now in a loaded state and is showing the counter
|
||||
var deferred = deferFulfillment(viewModel.context.$viewState) { viewState in
|
||||
@@ -189,7 +185,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
// check if the banner is now in a loaded state and is showing the counter
|
||||
var deferred = deferFulfillment(viewModel.context.$viewState) { viewState in
|
||||
@@ -230,9 +225,7 @@ final class RoomScreenViewModelTests {
|
||||
let roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
let powerLevelsMock = RoomPowerLevelsProxyMock(.init())
|
||||
powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(false)
|
||||
powerLevelsMock.canOwnUserJoinCallReturnValue = false
|
||||
roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock)
|
||||
|
||||
let roomInfoProxyMock = RoomInfoProxyMock(configuration)
|
||||
roomInfoProxyMock.powerLevels = powerLevelsMock
|
||||
@@ -248,7 +241,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
#expect(viewModel.state.roomTitle == "StartingName")
|
||||
#expect(viewModel.state.roomAvatar == .room(id: "TestID", name: "StartingName", avatarURL: nil))
|
||||
@@ -265,7 +257,6 @@ final class RoomScreenViewModelTests {
|
||||
configuration.name = "NewName"
|
||||
configuration.avatarURL = .mockMXCAvatar
|
||||
configuration.hasOngoingCall = true
|
||||
powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(true)
|
||||
|
||||
infoSubject.send(RoomInfoProxyMock(configuration))
|
||||
|
||||
@@ -285,7 +276,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
#expect(viewModel.state.shouldShowCallButton)
|
||||
|
||||
// When a call starts in this room.
|
||||
@@ -330,7 +320,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
viewModel.stop()
|
||||
}
|
||||
}
|
||||
@@ -351,7 +340,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
var deferred = deferFulfillment(viewModel.context.$viewState) { state in
|
||||
state.shouldSeeKnockRequests &&
|
||||
@@ -385,7 +373,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
var deferred = deferFulfillment(viewModel.context.$viewState) { state in
|
||||
state.shouldSeeKnockRequests &&
|
||||
@@ -414,7 +401,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
// Loading state just does not appear at all
|
||||
let deferred = deferFulfillment(viewModel.context.$viewState) { !$0.shouldSeeKnockRequests }
|
||||
@@ -434,7 +420,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
let deferred = deferFulfillment(viewModel.context.$viewState) { state in
|
||||
state.unseenKnockRequests == [.init(displayName: "Alice", avatarURL: nil, userID: "@alice:matrix.org", reason: "Hello World!", eventID: "1")] &&
|
||||
@@ -461,7 +446,6 @@ final class RoomScreenViewModelTests {
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
self.viewModel = viewModel
|
||||
|
||||
let deferredInvisible = deferFailure(viewModel.context.$viewState,
|
||||
timeout: .seconds(1),
|
||||
|
||||
@@ -14,7 +14,6 @@ import Testing
|
||||
@MainActor
|
||||
final class SecurityAndPrivacyScreenViewModelTests {
|
||||
var viewModel: SecurityAndPrivacyScreenViewModelProtocol!
|
||||
var spaceServiceProxy: SpaceServiceProxyMock!
|
||||
var roomProxy: JoinedRoomProxyMock!
|
||||
|
||||
var context: SecurityAndPrivacyScreenViewModelType.Context {
|
||||
|
||||
@@ -42,7 +42,6 @@ final class SpacesScreenViewModelTests {
|
||||
|
||||
viewModel = SpacesScreenViewModel(userSession: userSession,
|
||||
selectedSpacePublisher: .init(nil),
|
||||
appSettings: appSettings,
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@ struct StartChatScreenViewModelTests {
|
||||
viewModel = StartChatScreenViewModel(userSession: userSession,
|
||||
analytics: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
appSettings: appSettings)
|
||||
userDiscoveryService: userDiscoveryService)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -125,6 +125,7 @@ func waitForConfirmation<R>(_ comment: Comment? = nil,
|
||||
}
|
||||
}
|
||||
|
||||
// periphery:ignore:parameters isolation - inherits the caller's actor isolation
|
||||
/// Runs the body on the given actor, so that it can safely touch the caller's isolated state.
|
||||
///
|
||||
/// Swift Testing's `confirmation` runs its closure on the concurrent executor regardless of the
|
||||
|
||||
@@ -523,9 +523,7 @@ final class TimelineViewModelTests {
|
||||
try await deferred.fulfill()
|
||||
|
||||
let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init())
|
||||
powerLevelsProxyMock.canUserPinOrUnpinUserIDReturnValue = .success(false)
|
||||
powerLevelsProxyMock.canOwnUserPinOrUnpinReturnValue = false
|
||||
roomProxyMock.powerLevelsReturnValue = .success(powerLevelsProxyMock)
|
||||
|
||||
let roomInfoProxyMock = RoomInfoProxyMock(configuration)
|
||||
roomInfoProxyMock.powerLevels = powerLevelsProxyMock
|
||||
|
||||
@@ -159,7 +159,9 @@ private final class TestPreferences {
|
||||
}
|
||||
|
||||
private struct CodableTestType: Equatable, Codable {
|
||||
// periphery:ignore - used via the synthesized Codable conformance
|
||||
let a: String
|
||||
// periphery:ignore - used via the synthesized Codable conformance
|
||||
let b: [Int]
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ struct UserProfileScreenViewModelTests {
|
||||
isPresentedModally: false,
|
||||
userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
userIndicatorController: userIndicatorController,
|
||||
analytics: AnalyticsServiceMock(.init()),
|
||||
appSettings: .volatile())
|
||||
analytics: AnalyticsServiceMock(.init()))
|
||||
let context = viewModel.context
|
||||
|
||||
let waitForMemberToLoad = deferFulfillment(context.observe(\.viewState.userProfile)) { $0 != nil }
|
||||
@@ -47,8 +46,7 @@ struct UserProfileScreenViewModelTests {
|
||||
isPresentedModally: false,
|
||||
userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
userIndicatorController: userIndicatorController,
|
||||
analytics: AnalyticsServiceMock(.init()),
|
||||
appSettings: .volatile())
|
||||
analytics: AnalyticsServiceMock(.init()))
|
||||
let context = viewModel.context
|
||||
|
||||
let waitForMemberToLoad = deferFulfillment(context.observe(\.viewState.userProfile)) { $0 != nil }
|
||||
@@ -73,8 +71,7 @@ struct UserProfileScreenViewModelTests {
|
||||
isPresentedModally: false,
|
||||
userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
userIndicatorController: userIndicatorController,
|
||||
analytics: AnalyticsServiceMock(.init()),
|
||||
appSettings: .volatile())
|
||||
analytics: AnalyticsServiceMock(.init()))
|
||||
|
||||
let context = viewModel.context
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ struct UserSessionFlowCoordinatorTests {
|
||||
|
||||
private let networkReachabilitySubject: CurrentValueSubject<NetworkMonitorReachability, Never> = .init(.reachable)
|
||||
private let homeserverReachabilitySubject: CurrentValueSubject<HomeserverReachability, Never> = .init(.reachable)
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
private var tabCoordinator: NavigationTabCoordinator<UserSessionFlowCoordinator.HomeTab>? {
|
||||
rootCoordinator?.rootCoordinator as? NavigationTabCoordinator
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ struct VoiceMessageRecorderTests {
|
||||
audioPlayer = AudioPlayerMock()
|
||||
audioPlayer.actions = audioPlayerActions
|
||||
audioPlayer.state = .stopped
|
||||
audioPlayer.playbackSpeed = 1.0
|
||||
|
||||
mediaPlayerProvider = MediaPlayerProviderMock()
|
||||
mediaPlayerProvider.player = audioPlayer
|
||||
|
||||
@@ -60,7 +60,6 @@ targets:
|
||||
- path: ../../DevelopmentAssets/ClassicAppFixtures
|
||||
buildPhase: resources # Necessary to add binary files to the target.
|
||||
- path: ../../ElementX/Sources/Other/Extensions/Publisher.swift
|
||||
- path: ../../ElementX/Sources/Other/Extensions/XCTestCase.swift
|
||||
- path: ../../ElementX/Sources/Other/InfoPlistReader.swift
|
||||
- path: ../../Tools/Scripts/Templates/SimpleScreenExample/Tests/Unit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user