Skip to content

Commit

Permalink
Fix unit tests following botched SDK bump
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Oct 12, 2023
1 parent b5e334f commit 6791a95
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions UnitTests/Sources/MediaProvider/MediaLoaderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import XCTest
final class MediaLoaderTests: XCTestCase {
func testMediaRequestCoalescing() async {
let mediaLoadingClient = SDKClientMock()
mediaLoadingClient.getMediaContentMediaSourceReturnValue = []
mediaLoadingClient.getMediaContentMediaSourceReturnValue = Data()
let mediaLoader = MediaLoader(client: mediaLoadingClient)

let mediaSource = MediaSourceProxy(url: URL.documentsDirectory, mimeType: nil)
Expand All @@ -39,7 +39,7 @@ final class MediaLoaderTests: XCTestCase {

func testMediaThumbnailRequestCoalescing() async {
let mediaLoadingClient = SDKClientMock()
mediaLoadingClient.getMediaThumbnailMediaSourceWidthHeightReturnValue = []
mediaLoadingClient.getMediaThumbnailMediaSourceWidthHeightReturnValue = Data()
let mediaLoader = MediaLoader(client: mediaLoadingClient)

let mediaSource = MediaSourceProxy(url: URL.documentsDirectory, mimeType: nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class NotificationSettingsEditScreenViewModelTests: XCTestCase {

func testSetModeFailure() async throws {
notificationSettingsProxy.getDefaultRoomNotificationModeIsEncryptedIsOneToOneReturnValue = .mentionsAndKeywordsOnly
notificationSettingsProxy.setDefaultRoomNotificationModeIsEncryptedIsOneToOneModeThrowableError = NotificationSettingsError.Generic(message: "error")
notificationSettingsProxy.setDefaultRoomNotificationModeIsEncryptedIsOneToOneModeThrowableError = NotificationSettingsError.Generic(msg: "error")
viewModel = NotificationSettingsEditScreenViewModel(chatType: .oneToOneChat,
userSession: userSession,
notificationSettingsProxy: notificationSettingsProxy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
}

func testToggleRoomMentionFailure() async throws {
notificationSettingsProxy.setRoomMentionEnabledEnabledThrowableError = NotificationSettingsError.Generic(message: "error")
notificationSettingsProxy.setRoomMentionEnabledEnabledThrowableError = NotificationSettingsError.Generic(msg: "error")
notificationSettingsProxy.isRoomMentionEnabledReturnValue = false

let deferredInitialFetch = deferFulfillment(viewModel.context.$viewState) { state in
Expand Down Expand Up @@ -357,7 +357,7 @@ class NotificationSettingsScreenViewModelTests: XCTestCase {
}

func testToggleCallsFailure() async throws {
notificationSettingsProxy.setCallEnabledEnabledThrowableError = NotificationSettingsError.Generic(message: "error")
notificationSettingsProxy.setCallEnabledEnabledThrowableError = NotificationSettingsError.Generic(msg: "error")
notificationSettingsProxy.isCallEnabledReturnValue = false

let deferredInitialFetch = deferFulfillment(viewModel.context.$viewState) { state in
Expand Down
6 changes: 3 additions & 3 deletions UnitTests/Sources/RoomDetailsViewModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
// MARK: - Notifications

func testNotificationLoadingSettingsFailure() async throws {
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(message: "error")
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(msg: "error")
viewModel = RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com",
roomProxy: roomProxyMock,
mediaProvider: MockMediaProvider(),
Expand Down Expand Up @@ -506,7 +506,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
defer {
expectation.fulfill()
}
throw NotificationSettingsError.Generic(message: "unmute error")
throw NotificationSettingsError.Generic(msg: "unmute error")
}
context.send(viewAction: .processToogleMuteNotifications)
await fulfillment(of: [expectation])
Expand All @@ -531,7 +531,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
defer {
expectation.fulfill()
}
throw NotificationSettingsError.Generic(message: "mute error")
throw NotificationSettingsError.Generic(msg: "mute error")
}
context.send(viewAction: .processToogleMuteNotifications)
await fulfillment(of: [expectation])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
}

func testInitialStateFailure() async throws {
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(message: "error")
notificationSettingsProxyMock.getNotificationSettingsRoomIdIsEncryptedIsOneToOneThrowableError = NotificationSettingsError.Generic(msg: "error")
let viewModel = RoomNotificationSettingsScreenViewModel(notificationSettingsProxy: notificationSettingsProxyMock,
roomProxy: roomProxyMock,
displayAsUserDefinedRoomSettings: false)
Expand Down Expand Up @@ -235,7 +235,7 @@ class RoomNotificationSettingsScreenViewModelTests: XCTestCase {

func testDeleteCustomSettingTappedFailure() async throws {
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,
roomProxy: roomProxyMock,
displayAsUserDefinedRoomSettings: true)
Expand Down

0 comments on commit 6791a95

Please sign in to comment.