mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Fix unit tests following botched SDK bump
This commit is contained in:
@@ -21,7 +21,7 @@ import XCTest
|
|||||||
final class MediaLoaderTests: XCTestCase {
|
final class MediaLoaderTests: XCTestCase {
|
||||||
func testMediaRequestCoalescing() async {
|
func testMediaRequestCoalescing() async {
|
||||||
let mediaLoadingClient = SDKClientMock()
|
let mediaLoadingClient = SDKClientMock()
|
||||||
mediaLoadingClient.getMediaContentMediaSourceReturnValue = []
|
mediaLoadingClient.getMediaContentMediaSourceReturnValue = Data()
|
||||||
let mediaLoader = MediaLoader(client: mediaLoadingClient)
|
let mediaLoader = MediaLoader(client: mediaLoadingClient)
|
||||||
|
|
||||||
let mediaSource = MediaSourceProxy(url: URL.documentsDirectory, mimeType: nil)
|
let mediaSource = MediaSourceProxy(url: URL.documentsDirectory, mimeType: nil)
|
||||||
@@ -39,7 +39,7 @@ final class MediaLoaderTests: XCTestCase {
|
|||||||
|
|
||||||
func testMediaThumbnailRequestCoalescing() async {
|
func testMediaThumbnailRequestCoalescing() async {
|
||||||
let mediaLoadingClient = SDKClientMock()
|
let mediaLoadingClient = SDKClientMock()
|
||||||
mediaLoadingClient.getMediaThumbnailMediaSourceWidthHeightReturnValue = []
|
mediaLoadingClient.getMediaThumbnailMediaSourceWidthHeightReturnValue = Data()
|
||||||
let mediaLoader = MediaLoader(client: mediaLoadingClient)
|
let mediaLoader = MediaLoader(client: mediaLoadingClient)
|
||||||
|
|
||||||
let mediaSource = MediaSourceProxy(url: URL.documentsDirectory, mimeType: nil)
|
let mediaSource = MediaSourceProxy(url: URL.documentsDirectory, mimeType: nil)
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ class NotificationSettingsEditScreenViewModelTests: XCTestCase {
|
|||||||
|
|
||||||
func testSetModeFailure() async throws {
|
func testSetModeFailure() async throws {
|
||||||
notificationSettingsProxy.getDefaultRoomNotificationModeIsEncryptedIsOneToOneReturnValue = .mentionsAndKeywordsOnly
|
notificationSettingsProxy.getDefaultRoomNotificationModeIsEncryptedIsOneToOneReturnValue = .mentionsAndKeywordsOnly
|
||||||
notificationSettingsProxy.setDefaultRoomNotificationModeIsEncryptedIsOneToOneModeThrowableError = NotificationSettingsError.Generic(message: "error")
|
notificationSettingsProxy.setDefaultRoomNotificationModeIsEncryptedIsOneToOneModeThrowableError = NotificationSettingsError.Generic(msg: "error")
|
||||||
viewModel = NotificationSettingsEditScreenViewModel(chatType: .oneToOneChat,
|
viewModel = NotificationSettingsEditScreenViewModel(chatType: .oneToOneChat,
|
||||||
userSession: userSession,
|
userSession: userSession,
|
||||||
notificationSettingsProxy: notificationSettingsProxy)
|
notificationSettingsProxy: notificationSettingsProxy)
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testToggleRoomMentionFailure() async throws {
|
func testToggleRoomMentionFailure() async throws {
|
||||||
notificationSettingsProxy.setRoomMentionEnabledEnabledThrowableError = NotificationSettingsError.Generic(message: "error")
|
notificationSettingsProxy.setRoomMentionEnabledEnabledThrowableError = NotificationSettingsError.Generic(msg: "error")
|
||||||
notificationSettingsProxy.isRoomMentionEnabledReturnValue = false
|
notificationSettingsProxy.isRoomMentionEnabledReturnValue = false
|
||||||
|
|
||||||
let deferredInitialFetch = deferFulfillment(viewModel.context.$viewState) { state in
|
let deferredInitialFetch = deferFulfillment(viewModel.context.$viewState) { state in
|
||||||
@@ -357,7 +357,7 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testToggleCallsFailure() async throws {
|
func testToggleCallsFailure() async throws {
|
||||||
notificationSettingsProxy.setCallEnabledEnabledThrowableError = NotificationSettingsError.Generic(message: "error")
|
notificationSettingsProxy.setCallEnabledEnabledThrowableError = NotificationSettingsError.Generic(msg: "error")
|
||||||
notificationSettingsProxy.isCallEnabledReturnValue = false
|
notificationSettingsProxy.isCallEnabledReturnValue = false
|
||||||
|
|
||||||
let deferredInitialFetch = deferFulfillment(viewModel.context.$viewState) { state in
|
let deferredInitialFetch = deferFulfillment(viewModel.context.$viewState) { state in
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
|||||||
// MARK: - Notifications
|
// MARK: - Notifications
|
||||||
|
|
||||||
func testNotificationLoadingSettingsFailure() async throws {
|
func testNotificationLoadingSettingsFailure() async throws {
|
||||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(message: "error")
|
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(msg: "error")
|
||||||
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
|
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
|
||||||
roomProxy: roomProxyMock,
|
roomProxy: roomProxyMock,
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
@@ -506,7 +506,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
|||||||
defer {
|
defer {
|
||||||
expectation.fulfill()
|
expectation.fulfill()
|
||||||
}
|
}
|
||||||
throw NotificationSettingsError.Generic(message: "unmute error")
|
throw NotificationSettingsError.Generic(msg: "unmute error")
|
||||||
}
|
}
|
||||||
context.send(viewAction: .processToogleMuteNotifications)
|
context.send(viewAction: .processToogleMuteNotifications)
|
||||||
await fulfillment(of: [expectation])
|
await fulfillment(of: [expectation])
|
||||||
@@ -531,7 +531,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
|||||||
defer {
|
defer {
|
||||||
expectation.fulfill()
|
expectation.fulfill()
|
||||||
}
|
}
|
||||||
throw NotificationSettingsError.Generic(message: "mute error")
|
throw NotificationSettingsError.Generic(msg: "mute error")
|
||||||
}
|
}
|
||||||
context.send(viewAction: .processToogleMuteNotifications)
|
context.send(viewAction: .processToogleMuteNotifications)
|
||||||
await fulfillment(of: [expectation])
|
await fulfillment(of: [expectation])
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testInitialStateFailure() async throws {
|
func testInitialStateFailure() async throws {
|
||||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(message: "error")
|
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(msg: "error")
|
||||||
let viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
let viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
||||||
roomProxy: roomProxyMock,
|
roomProxy: roomProxyMock,
|
||||||
displayAsUserDefinedRoomSettings: false)
|
displayAsUserDefinedRoomSettings: false)
|
||||||
@@ -235,7 +235,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
|||||||
|
|
||||||
func testDeleteCustomSettingTappedFailure() async throws {
|
func testDeleteCustomSettingTappedFailure() async throws {
|
||||||
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneReturnValue = RoomNotificationSettingsProxyMock(with: .init(mode: .mentionsAndKeywordsOnly, isDefault: false))
|
||||||
notificationSettingsProxyMock.restoreDefaultNotificationModeRoomIdThrowableError = NotificationSettingsError.Generic(message: "error")
|
notificationSettingsProxyMock.restoreDefaultNotificationModeRoomIdThrowableError = NotificationSettingsError.Generic(msg: "error")
|
||||||
let viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
let viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
|
||||||
roomProxy: roomProxyMock,
|
roomProxy: roomProxyMock,
|
||||||
displayAsUserDefinedRoomSettings: true)
|
displayAsUserDefinedRoomSettings: true)
|
||||||
|
|||||||
Reference in New Issue
Block a user