mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Update files following swiftformat upgrade
This commit is contained in:
committed by
Stefan Ceriu
parent
fe189fcfed
commit
23062901c0
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import AVKit
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
final class AVMetadataMachineReadableCodeObjectExtensionsTest: XCTestCase {
|
||||
func testDecodeQRCodeVersion8() {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class AnalyticsSettingsScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -210,11 +210,9 @@ class AnalyticsTests: XCTestCase {
|
||||
let client = PostHogAnalyticsClient(posthogFactory: MockPostHogFactory(mock: posthogMock))
|
||||
try client.start(analyticsConfiguration: XCTUnwrap(appSettings.analyticsConfiguration))
|
||||
|
||||
client.updateSuperProperties(
|
||||
AnalyticsEvent.SuperProperties(appPlatform: .EXI,
|
||||
cryptoSDK: .Rust,
|
||||
cryptoSDKVersion: "000")
|
||||
)
|
||||
client.updateSuperProperties(AnalyticsEvent.SuperProperties(appPlatform: .EXI,
|
||||
cryptoSDK: .Rust,
|
||||
cryptoSDKVersion: "000"))
|
||||
|
||||
// When sending an event (tests run under Debug configuration so this is sent to the development instance)
|
||||
client.screen(AnalyticsEvent.MobileScreen(durationMs: nil, screenName: .Home))
|
||||
@@ -250,11 +248,9 @@ class AnalyticsTests: XCTestCase {
|
||||
XCTAssertEqual(capturedEvent?.properties?["cryptoSDKVersion"] as? String, "000")
|
||||
|
||||
// Updating should keep the previously set properties
|
||||
client.updateSuperProperties(
|
||||
AnalyticsEvent.SuperProperties(appPlatform: .EXI,
|
||||
cryptoSDK: .Rust,
|
||||
cryptoSDKVersion: "001")
|
||||
)
|
||||
client.updateSuperProperties(AnalyticsEvent.SuperProperties(appPlatform: .EXI,
|
||||
cryptoSDK: .Rust,
|
||||
cryptoSDKVersion: "001"))
|
||||
|
||||
client.capture(someEvent)
|
||||
let capturedEvent2 = posthogMock.capturePropertiesUserPropertiesReceivedArguments
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class AppLockScreenViewModelTests: XCTestCase {
|
||||
@@ -17,7 +16,9 @@ class AppLockScreenViewModelTests: XCTestCase {
|
||||
var keychainController: KeychainControllerMock!
|
||||
var viewModel: AppLockScreenViewModelProtocol!
|
||||
|
||||
var context: AppLockScreenViewModelType.Context { viewModel.context }
|
||||
var context: AppLockScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
AppSettings.resetAllSettings()
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class AppLockServiceTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class AppLockSetupSettingsScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,16 +6,17 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class AppLockSetupBiometricsScreenViewModelTests: XCTestCase {
|
||||
var appLockService: AppLockServiceMock!
|
||||
var viewModel: AppLockSetupBiometricsScreenViewModelProtocol!
|
||||
|
||||
var context: AppLockSetupBiometricsScreenViewModelType.Context { viewModel.context }
|
||||
var context: AppLockSetupBiometricsScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
AppSettings.resetAllSettings()
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class AppLockSetupPINScreenViewModelTests: XCTestCase {
|
||||
@@ -16,7 +15,9 @@ class AppLockSetupPINScreenViewModelTests: XCTestCase {
|
||||
var keychainController: KeychainControllerMock!
|
||||
var viewModel: AppLockSetupPINScreenViewModelProtocol!
|
||||
|
||||
var context: AppLockSetupPINScreenViewModelType.Context { viewModel.context }
|
||||
var context: AppLockSetupPINScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
AppSettings.resetAllSettings()
|
||||
|
||||
@@ -6,19 +6,29 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
class AppLockTimerTests: XCTestCase {
|
||||
var timer: AppLockTimer!
|
||||
|
||||
let now = Date.now
|
||||
|
||||
var gracePeriod: TimeInterval { timer.gracePeriod }
|
||||
var halfGracePeriod: TimeInterval { gracePeriod / 2 }
|
||||
var gracePeriodX2: TimeInterval { gracePeriod * 2 }
|
||||
var gracePeriodX10: TimeInterval { gracePeriod * 10 }
|
||||
var gracePeriod: TimeInterval {
|
||||
timer.gracePeriod
|
||||
}
|
||||
|
||||
var halfGracePeriod: TimeInterval {
|
||||
gracePeriod / 2
|
||||
}
|
||||
|
||||
var gracePeriodX2: TimeInterval {
|
||||
gracePeriod * 2
|
||||
}
|
||||
|
||||
var gracePeriodX10: TimeInterval {
|
||||
gracePeriod * 10
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
timer = nil
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
class PINTextFieldTests: XCTestCase {
|
||||
func testSanitize() {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
class AppRouteURLParserTests: XCTestCase {
|
||||
var appSettings: AppSettings!
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
class ArrayTests: XCTestCase {
|
||||
func testGrouping() {
|
||||
|
||||
@@ -770,7 +770,7 @@ class AttributedStringBuilderTests: XCTestCase {
|
||||
XCTAssertEqual(String(attributedString.characters), " 1. A\n • A1\n • A2\n • A3\n 2. B\n 3. C")
|
||||
}
|
||||
|
||||
// https://github.com/element-hq/element-x-ios/issues/4856
|
||||
/// https://github.com/element-hq/element-x-ios/issues/4856
|
||||
func testNormalisedWhitespaces() {
|
||||
let html = """
|
||||
<a href="https://github.com/stefan">Stefan</a> pushed
|
||||
|
||||
@@ -46,14 +46,14 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testAttach() async throws {
|
||||
func testAttach() {
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
XCTAssert(audioPlayerState.isAttached)
|
||||
XCTAssertEqual(audioPlayerState.playbackState, .loading)
|
||||
}
|
||||
|
||||
func testDetach() async throws {
|
||||
func testDetach() {
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
audioPlayerState.detachAudioPlayer()
|
||||
@@ -103,13 +103,13 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
XCTAssertEqual(audioPlayerState.playerButtonPlaybackState, .playing)
|
||||
}
|
||||
|
||||
func testReportError() async throws {
|
||||
func testReportError() {
|
||||
XCTAssertEqual(audioPlayerState.playbackState, .stopped)
|
||||
audioPlayerState.reportError()
|
||||
XCTAssertEqual(audioPlayerState.playbackState, .error)
|
||||
}
|
||||
|
||||
func testUpdateProgress() async throws {
|
||||
func testUpdateProgress() async {
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
// If we try to set a negative progress, the new progress must be 0.0
|
||||
|
||||
@@ -36,12 +36,12 @@ class AudioRecorderStateTests: XCTestCase {
|
||||
audioRecorderMock = buildAudioRecorderMock()
|
||||
}
|
||||
|
||||
func testAttach() async throws {
|
||||
func testAttach() {
|
||||
audioRecorderState.attachAudioRecorder(audioRecorderMock)
|
||||
XCTAssertEqual(audioRecorderState.recordingState, .stopped)
|
||||
}
|
||||
|
||||
func testDetach() async throws {
|
||||
func testDetach() async {
|
||||
audioRecorderState.attachAudioRecorder(audioRecorderMock)
|
||||
audioRecorderMock.isRecording = true
|
||||
await audioRecorderState.detachAudioRecorder()
|
||||
@@ -49,7 +49,7 @@ class AudioRecorderStateTests: XCTestCase {
|
||||
XCTAssertEqual(audioRecorderState.recordingState, .stopped)
|
||||
}
|
||||
|
||||
func testReportError() async throws {
|
||||
func testReportError() {
|
||||
XCTAssertEqual(audioRecorderState.recordingState, .stopped)
|
||||
audioRecorderState.reportError()
|
||||
XCTAssertEqual(audioRecorderState.recordingState, .error)
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDKMocks
|
||||
import XCTest
|
||||
|
||||
class AuthenticationServiceTests: XCTestCase {
|
||||
var client: ClientSDKMock!
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDKMocks
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class AuthenticationStartScreenViewModelTests: XCTestCase {
|
||||
@@ -19,7 +18,9 @@ class AuthenticationStartScreenViewModelTests: XCTestCase {
|
||||
var authenticationService: AuthenticationServiceProtocol!
|
||||
|
||||
var viewModel: AuthenticationStartScreenViewModel!
|
||||
var context: AuthenticationStartScreenViewModel.Context { viewModel.context }
|
||||
var context: AuthenticationStartScreenViewModel.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
AppSettings.resetAllSettings()
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class BlockedUsersScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class BugReportScreenViewModelTests: XCTestCase {
|
||||
@@ -32,7 +31,7 @@ class BugReportScreenViewModelTests: XCTestCase {
|
||||
XCTAssertTrue(context.sendingLogsEnabled)
|
||||
}
|
||||
|
||||
func testClearScreenshot() async throws {
|
||||
func testClearScreenshot() {
|
||||
let clientProxy = ClientProxyMock(.init(userID: "@mock.client.com"))
|
||||
let viewModel = BugReportScreenViewModel(bugReportService: BugReportServiceMock(),
|
||||
clientProxy: clientProxy,
|
||||
@@ -45,7 +44,7 @@ class BugReportScreenViewModelTests: XCTestCase {
|
||||
XCTAssertNil(context.viewState.screenshot)
|
||||
}
|
||||
|
||||
func testAttachScreenshot() async throws {
|
||||
func testAttachScreenshot() {
|
||||
let clientProxy = ClientProxyMock(.init(userID: "@mock.client.com"))
|
||||
let viewModel = BugReportScreenViewModel(bugReportService: BugReportServiceMock(),
|
||||
clientProxy: clientProxy,
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
@@ -51,7 +50,7 @@ class BugReportServiceTests: XCTestCase {
|
||||
XCTAssertFalse(reportURL.isEmpty)
|
||||
}
|
||||
|
||||
func testInitialStateWithRealService() throws {
|
||||
func testInitialStateWithRealService() {
|
||||
let urlPublisher: CurrentValueSubject<RageshakeConfiguration, Never> = .init(.url("https://example.com/submit"))
|
||||
let service = BugReportService(rageshakeURLPublisher: urlPublisher.asCurrentValuePublisher(),
|
||||
applicationID: "mock_app_id",
|
||||
@@ -63,7 +62,7 @@ class BugReportServiceTests: XCTestCase {
|
||||
XCTAssertFalse(service.crashedLastRun)
|
||||
}
|
||||
|
||||
func testInitialStateWithRealServiceAndDisabled() throws {
|
||||
func testInitialStateWithRealServiceAndDisabled() {
|
||||
let urlPublisher: CurrentValueSubject<RageshakeConfiguration, Never> = .init(.disabled)
|
||||
let service = BugReportService(rageshakeURLPublisher: urlPublisher.asCurrentValuePublisher(),
|
||||
applicationID: "mock_app_id",
|
||||
@@ -198,7 +197,6 @@ private extension URLSession {
|
||||
static var mock: URLSession {
|
||||
let configuration = URLSessionConfiguration.default
|
||||
configuration.protocolClasses = [MockURLProtocol.self] + (configuration.protocolClasses ?? [])
|
||||
let result = URLSession(configuration: configuration)
|
||||
return result
|
||||
return URLSession(configuration: configuration)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class CallScreenViewModelTests: XCTestCase { }
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class ChatsTabFlowCoordinatorTests: XCTestCase {
|
||||
@@ -22,8 +21,13 @@ class ChatsTabFlowCoordinatorTests: XCTestCase {
|
||||
|
||||
var cancellables = Set<AnyCancellable>()
|
||||
|
||||
var detailCoordinator: CoordinatorProtocol? { splitCoordinator?.detailCoordinator }
|
||||
var detailNavigationStack: NavigationStackCoordinator? { detailCoordinator as? NavigationStackCoordinator }
|
||||
var detailCoordinator: CoordinatorProtocol? {
|
||||
splitCoordinator?.detailCoordinator
|
||||
}
|
||||
|
||||
var detailNavigationStack: NavigationStackCoordinator? {
|
||||
detailCoordinator as? NavigationStackCoordinator
|
||||
}
|
||||
|
||||
override func setUp() async throws {
|
||||
cancellables.removeAll()
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class CompletionSuggestionServiceTests: XCTestCase {
|
||||
|
||||
@@ -9,9 +9,8 @@
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
import WysiwygComposer
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class ComposerToolbarViewModelTests: XCTestCase {
|
||||
@@ -144,13 +143,13 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
||||
XCTAssertEqual(wysiwygViewModel.content.html, "<a href=\"https://matrix.to/#/%23room-alias:matrix.org\">#room-alias:matrix.org</a> ")
|
||||
}
|
||||
|
||||
func testAllUsersSuggestion() {
|
||||
func testAllUsersSuggestion() throws {
|
||||
let suggestion = SuggestionItem(suggestionType: .allUsers(.room(id: "", name: nil, avatarURL: nil)), range: .init(), rawSuggestionText: "")
|
||||
viewModel.context.send(viewAction: .selectedSuggestion(suggestion))
|
||||
|
||||
var string = "@room"
|
||||
// swiftlint:disable:next force_unwrapping
|
||||
string.unicodeScalars.append(UnicodeScalar(String.nbsp)!)
|
||||
try string.unicodeScalars.append(XCTUnwrap(UnicodeScalar(String.nbsp)))
|
||||
XCTAssertEqual(wysiwygViewModel.content.html, string)
|
||||
}
|
||||
|
||||
@@ -187,12 +186,10 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testIntentionalMentions() async throws {
|
||||
wysiwygViewModel.setHtmlContent(
|
||||
"""
|
||||
<p>Hello @room \
|
||||
and especially hello to <a href=\"https://matrix.to/#/@test:matrix.org\">Test</a></p>
|
||||
"""
|
||||
)
|
||||
wysiwygViewModel.setHtmlContent("""
|
||||
<p>Hello @room \
|
||||
and especially hello to <a href=\"https://matrix.to/#/@test:matrix.org\">Test</a></p>
|
||||
""")
|
||||
|
||||
let deferred = deferFulfillment(viewModel.actions) { action in
|
||||
switch action {
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class CreateRoomScreenViewModelTests: XCTestCase {
|
||||
@@ -306,7 +305,7 @@ class CreateRoomScreenViewModelTests: XCTestCase {
|
||||
XCTAssertEqual(clientProxy.createRoomNameTopicAccessTypeIsSpaceUserIDsAvatarURLAliasLocalPartReceivedArguments?.accessType, .spaceMembers(spaceID: space.id))
|
||||
}
|
||||
|
||||
func testCreateRoomInAnPublicSpaceAvailableTypes() async throws {
|
||||
func testCreateRoomInAnPublicSpaceAvailableTypes() {
|
||||
let space = SpaceServiceRoom.mock(isSpace: true, joinRule: .public)
|
||||
setup(spacesSelectionMode: .preSelected(space))
|
||||
|
||||
|
||||
@@ -16,44 +16,44 @@ class DateTests: XCTestCase {
|
||||
let startOfToday = Calendar.current.startOfDay(for: .now)
|
||||
let startOfYesterday = Calendar.current.startOfDay(for: Calendar.current.date(byAdding: .day, value: -1, to: .now)!)
|
||||
|
||||
func testMinimalDateFormatting() {
|
||||
let today = calendar.date(byAdding: DateComponents(hour: 9, minute: 30), to: startOfToday)!
|
||||
func testMinimalDateFormatting() throws {
|
||||
let today = try XCTUnwrap(calendar.date(byAdding: DateComponents(hour: 9, minute: 30), to: startOfToday))
|
||||
XCTAssertEqual(today.formattedMinimal(), today.formatted(date: .omitted, time: .shortened))
|
||||
|
||||
let yesterday = calendar.date(byAdding: .hour, value: 1, to: startOfYesterday)!
|
||||
let yesterday = try XCTUnwrap(calendar.date(byAdding: .hour, value: 1, to: startOfYesterday))
|
||||
XCTAssertEqual(yesterday.formattedMinimal(), yesterday.formatted(Date.RelativeFormatStyle(presentation: .named, capitalizationContext: .beginningOfSentence)))
|
||||
|
||||
let nearYesterday = calendar.date(byAdding: DateComponents(hour: -10), to: today)!
|
||||
let nearYesterday = try XCTUnwrap(calendar.date(byAdding: DateComponents(hour: -10), to: today))
|
||||
XCTAssertEqual(nearYesterday.formattedMinimal(), yesterday.formatted(Date.RelativeFormatStyle(presentation: .named, capitalizationContext: .beginningOfSentence)))
|
||||
|
||||
let threeDaysAgo = calendar.date(byAdding: .day, value: -3, to: startOfToday)!
|
||||
let threeDaysAgo = try XCTUnwrap(calendar.date(byAdding: .day, value: -3, to: startOfToday))
|
||||
XCTAssertEqual(threeDaysAgo.formattedMinimal(), threeDaysAgo.formatted(.dateTime.weekday(.wide)))
|
||||
|
||||
let sometimeInTheLastYear = calendar.date(byAdding: .month, value: -10, to: startOfToday)!
|
||||
let sometimeInTheLastYear = try XCTUnwrap(calendar.date(byAdding: .month, value: -10, to: startOfToday))
|
||||
XCTAssertEqual(sometimeInTheLastYear.formattedMinimal(), sometimeInTheLastYear.formatted(.dateTime.day().month()))
|
||||
|
||||
let theMillennium = calendar.date(from: DateComponents(year: 2000, month: 1, day: 1))!
|
||||
let theMillennium = try XCTUnwrap(calendar.date(from: DateComponents(year: 2000, month: 1, day: 1)))
|
||||
XCTAssertEqual(theMillennium.formattedMinimal(), theMillennium.formatted(.dateTime.year().day().month()))
|
||||
}
|
||||
|
||||
func testDateSeparatorFormatting() {
|
||||
let today = calendar.date(byAdding: DateComponents(hour: 9, minute: 30), to: startOfToday)!
|
||||
func testDateSeparatorFormatting() throws {
|
||||
let today = try XCTUnwrap(calendar.date(byAdding: DateComponents(hour: 9, minute: 30), to: startOfToday))
|
||||
XCTAssertEqual(today.formattedDateSeparator(), "Today")
|
||||
|
||||
let yesterday = calendar.date(byAdding: .hour, value: 1, to: startOfYesterday)!
|
||||
let yesterday = try XCTUnwrap(calendar.date(byAdding: .hour, value: 1, to: startOfYesterday))
|
||||
XCTAssertEqual(yesterday.formattedDateSeparator(), "Yesterday")
|
||||
|
||||
let nearYesterday = calendar.date(byAdding: DateComponents(hour: -10), to: today)!
|
||||
let nearYesterday = try XCTUnwrap(calendar.date(byAdding: DateComponents(hour: -10), to: today))
|
||||
XCTAssertEqual(nearYesterday.formattedDateSeparator(), yesterday.formatted(Date.RelativeFormatStyle(presentation: .named, capitalizationContext: .beginningOfSentence)))
|
||||
|
||||
let threeDaysAgo = calendar.date(byAdding: .day, value: -3, to: startOfToday)!
|
||||
let threeDaysAgo = try XCTUnwrap(calendar.date(byAdding: .day, value: -3, to: startOfToday))
|
||||
XCTAssertEqual(threeDaysAgo.formattedDateSeparator(), threeDaysAgo.formatted(.dateTime.weekday(.wide)))
|
||||
|
||||
// This test will fail during the first 6 days of the year.
|
||||
let startOfTheYear = calendar.dateInterval(of: .year, for: startOfToday)!.start
|
||||
let startOfTheYear = try XCTUnwrap(calendar.dateInterval(of: .year, for: startOfToday)?.start)
|
||||
XCTAssertEqual(startOfTheYear.formattedDateSeparator(), startOfTheYear.formatted(.dateTime.weekday(.wide).day().month(.wide)))
|
||||
|
||||
let theMillennium = calendar.date(from: DateComponents(year: 2000, month: 1, day: 1))!
|
||||
let theMillennium = try XCTUnwrap(calendar.date(from: DateComponents(year: 2000, month: 1, day: 1)))
|
||||
XCTAssertEqual(theMillennium.formattedDateSeparator(), theMillennium.formatted(.dateTime.weekday(.wide).day().month(.wide).year()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class DeactivateAccountScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class DeclineAndBlockScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class DeveloperOptionsScreenViewModelTests: XCTestCase { }
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class EditRoomAddressScreenViewModelTests: XCTestCase {
|
||||
@@ -66,7 +65,7 @@ class EditRoomAddressScreenViewModelTests: XCTestCase {
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
func testCorrectMethodsCalledOnSaveWhenNoAliasExists() async throws {
|
||||
func testCorrectMethodsCalledOnSaveWhenNoAliasExists() async {
|
||||
let clientProxy = ClientProxyMock(.init(userIDServerName: "matrix.org"))
|
||||
clientProxy.isAliasAvailableReturnValue = .success(true)
|
||||
let roomProxy = JoinedRoomProxyMock(.init(name: "Room Name"))
|
||||
@@ -98,7 +97,7 @@ class EditRoomAddressScreenViewModelTests: XCTestCase {
|
||||
XCTAssertFalse(roomProxy.removeRoomAliasFromRoomDirectoryCalled)
|
||||
}
|
||||
|
||||
func testCorrectMethodsCalledOnSaveWhenAliasOnSameHomeserverExists() async throws {
|
||||
func testCorrectMethodsCalledOnSaveWhenAliasOnSameHomeserverExists() async {
|
||||
let clientProxy = ClientProxyMock(.init(userIDServerName: "matrix.org"))
|
||||
clientProxy.isAliasAvailableReturnValue = .success(true)
|
||||
let roomProxy = JoinedRoomProxyMock(.init(name: "Room Name", canonicalAlias: "#old-room-name:matrix.org"))
|
||||
@@ -135,7 +134,7 @@ class EditRoomAddressScreenViewModelTests: XCTestCase {
|
||||
await fulfillment(of: [publishingExpectation, updateAliasExpectation, removeAliasExpectation], timeout: 1.0)
|
||||
}
|
||||
|
||||
func testCorrectMethodsCalledOnSaveWhenAliasOnOtherHomeserverExists() async throws {
|
||||
func testCorrectMethodsCalledOnSaveWhenAliasOnOtherHomeserverExists() async {
|
||||
let clientProxy = ClientProxyMock(.init(userIDServerName: "matrix.org"))
|
||||
clientProxy.isAliasAvailableReturnValue = .success(true)
|
||||
let roomProxy = JoinedRoomProxyMock(.init(name: "Room Name", canonicalAlias: "#old-room-name:element.io"))
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
//
|
||||
|
||||
import Clocks
|
||||
@testable import ElementX
|
||||
import PushKit
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class ElementCallServiceTests: XCTestCase {
|
||||
var callProvider: CXProviderMock!
|
||||
@@ -74,7 +73,7 @@ class ElementCallServiceTests: XCTestCase {
|
||||
await fulfillment(of: [expectation2], timeout: 1)
|
||||
}
|
||||
|
||||
func testExpiredRingLifetimeIsIgnored() async {
|
||||
func testExpiredRingLifetimeIsIgnored() {
|
||||
setupService()
|
||||
|
||||
XCTAssertFalse(callProvider.reportNewIncomingCallWithUpdateCompletionCalled)
|
||||
|
||||
@@ -6,16 +6,17 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class EmojiPickerScreenViewModelTests: XCTestCase {
|
||||
var timelineProxy: TimelineProxyMock!
|
||||
|
||||
var viewModel: EmojiPickerScreenViewModel!
|
||||
var context: EmojiPickerScreenViewModel.Context { viewModel.context }
|
||||
var context: EmojiPickerScreenViewModel.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
func testToggleReaction() async throws {
|
||||
setupViewModel()
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class EmojiProviderTests: XCTestCase {
|
||||
func testWhenEmojisLoadedCategoriesAreLoadedFromLoader() async throws {
|
||||
func testWhenEmojisLoadedCategoriesAreLoadedFromLoader() async {
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"])
|
||||
let category = EmojiCategory(id: "test", emojis: [item])
|
||||
|
||||
@@ -25,7 +24,7 @@ final class EmojiProviderTests: XCTestCase {
|
||||
XCTAssertEqual(emojiLoaderMock.categories, categories)
|
||||
}
|
||||
|
||||
func testWhenEmojisLoadedAndSearchStringEmptyAllCategoriesReturned() async throws {
|
||||
func testWhenEmojisLoadedAndSearchStringEmptyAllCategoriesReturned() async {
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"])
|
||||
let category = EmojiCategory(id: "test", emojis: [item])
|
||||
|
||||
@@ -38,7 +37,7 @@ final class EmojiProviderTests: XCTestCase {
|
||||
XCTAssertEqual(emojiLoaderMock.categories, categories)
|
||||
}
|
||||
|
||||
func testWhenEmojisLoadedSecondTimeCachedValuesAreUsed() async throws {
|
||||
func testWhenEmojisLoadedSecondTimeCachedValuesAreUsed() async {
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"])
|
||||
let item2 = EmojiItem(label: "test2", unicode: "test2", keywords: ["3", "4"], shortcodes: ["3", "4"])
|
||||
let categoriesForFirstLoad = [EmojiCategory(id: "test",
|
||||
@@ -58,7 +57,7 @@ final class EmojiProviderTests: XCTestCase {
|
||||
XCTAssertEqual(categories, categoriesForFirstLoad)
|
||||
}
|
||||
|
||||
func testWhenEmojisSearchedCorrectNumberOfCategoriesReturned() async throws {
|
||||
func testWhenEmojisSearchedCorrectNumberOfCategoriesReturned() async {
|
||||
let searchString = "smile"
|
||||
var categories = [EmojiCategory]()
|
||||
let item0WithSearchString = EmojiItem(label: "emoji0", unicode: "\(searchString)_123", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"])
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
class ExpiringTaskRunnerTests: XCTestCase {
|
||||
enum ExpiringTaskTestError: Error {
|
||||
|
||||
@@ -55,7 +55,7 @@ final class GeoURITests: XCTestCase {
|
||||
XCTAssertEqual(uri.string, "geo:53,-8;u=35")
|
||||
}
|
||||
|
||||
func testFormattingExponentialNotation() throws {
|
||||
func testFormattingExponentialNotation() {
|
||||
let uri = GeoURI(latitude: 1e2, longitude: -1e-2, uncertainty: 1e-4)
|
||||
XCTAssertEqual(uri.string, "geo:100,-0.01;u=0.0001")
|
||||
}
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class GlobalSearchScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class HomeScreenRoomTests: XCTestCase {
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class HomeScreenViewModelTests: XCTestCase {
|
||||
var viewModel: HomeScreenViewModelProtocol!
|
||||
var context: HomeScreenViewModelType.Context! { viewModel.context }
|
||||
var context: HomeScreenViewModelType.Context! {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
var clientProxy: ClientProxyMock!
|
||||
var roomSummaryProvider: RoomSummaryProviderMock!
|
||||
@@ -35,7 +36,7 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
AppSettings.resetAllSettings()
|
||||
}
|
||||
|
||||
func testSelectRoom() async throws {
|
||||
func testSelectRoom() async {
|
||||
setupViewModel()
|
||||
|
||||
let mockRoomID = "mock_room_id"
|
||||
@@ -60,7 +61,7 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
XCTAssertEqual(mockRoomID, selectedRoomID)
|
||||
}
|
||||
|
||||
func testTapUserAvatar() async throws {
|
||||
func testTapUserAvatar() async {
|
||||
setupViewModel()
|
||||
|
||||
var correctResult = false
|
||||
@@ -119,7 +120,7 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
XCTAssertNotNil(context.alertInfo)
|
||||
}
|
||||
|
||||
func testLeaveRoomSuccess() async throws {
|
||||
func testLeaveRoomSuccess() async {
|
||||
setupViewModel()
|
||||
|
||||
let mockRoomID = "1"
|
||||
@@ -147,7 +148,7 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
XCTAssertTrue(correctResult)
|
||||
}
|
||||
|
||||
func testShowRoomDetails() async throws {
|
||||
func testShowRoomDetails() async {
|
||||
setupViewModel()
|
||||
|
||||
let mockRoomID = "1"
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class InviteUsersScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
@@ -203,7 +202,7 @@ class JoinRoomScreenViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
extension JoinRoomScreenViewModelAction: @retroactive Equatable {
|
||||
// A close enough approximation for tests.
|
||||
/// A close enough approximation for tests.
|
||||
public static func == (lhs: JoinRoomScreenViewModelAction, rhs: JoinRoomScreenViewModelAction) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.joined(.roomID(let lhsRoomID)), .joined(.roomID(let rhsRoomID))):
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class KnockRequestsListScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class LegalInformationScreenViewModelTests: XCTestCase { }
|
||||
|
||||
@@ -53,7 +53,7 @@ class LoggingTests: XCTestCase {
|
||||
|
||||
/// This is meant to test the `Target.tests.configure(…)`, but at this stage the test is somewhat pointless
|
||||
/// as it is unlikely to have been called before `tearDown` has manually set the file prefix 😕.
|
||||
func testTargetName() throws {
|
||||
func testTargetName() {
|
||||
MXLog.info(UUID().uuidString)
|
||||
guard let logFile = Tracing.logFiles.first else {
|
||||
XCTFail(Constants.genericFailure)
|
||||
@@ -110,7 +110,7 @@ class LoggingTests: XCTestCase {
|
||||
XCTAssertFalse(content.contains(heroName))
|
||||
}
|
||||
|
||||
func testTimelineContentIsRedacted() async throws {
|
||||
func testTimelineContentIsRedacted() throws {
|
||||
try setupTest()
|
||||
|
||||
// Given timeline items that contain text
|
||||
@@ -274,7 +274,7 @@ class LoggingTests: XCTestCase {
|
||||
XCTAssertFalse(content.contains(rustFileMessage.filename))
|
||||
}
|
||||
|
||||
func testLogFileSorting() async throws {
|
||||
func testLogFileSorting() throws {
|
||||
try setupTest(redirectTracingFileWriter: false)
|
||||
|
||||
// Given a collection of log files.
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class LoginScreenViewModelTests: XCTestCase {
|
||||
var viewModel: LoginScreenViewModelProtocol!
|
||||
var context: LoginScreenViewModelType.Context { viewModel.context }
|
||||
var context: LoginScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
var clientFactory: AuthenticationClientFactoryMock!
|
||||
var service: AuthenticationServiceProtocol!
|
||||
@@ -159,7 +160,7 @@ class LoginScreenViewModelTests: XCTestCase {
|
||||
XCTAssertEqual(context.alertInfo?.id, .elementProAlert, "An alert should be shown to the user.")
|
||||
}
|
||||
|
||||
func testLoginHint() async throws {
|
||||
func testLoginHint() async {
|
||||
await setupViewModel(loginHint: "")
|
||||
XCTAssertEqual(context.username, "")
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class ManageRoomMemberSheetViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
class MatrixEntityRegexTests: XCTestCase {
|
||||
func testHomeserver() {
|
||||
|
||||
@@ -23,7 +23,7 @@ class MediaPlayerProviderTests: XCTestCase {
|
||||
mediaPlayerProvider = MediaPlayerProvider()
|
||||
}
|
||||
|
||||
func testPlayerStates() async throws {
|
||||
func testPlayerStates() {
|
||||
let audioPlayerStateId = AudioPlayerStateIdentifier.timelineItemIdentifier(.randomEvent)
|
||||
// By default, there should be no player state
|
||||
XCTAssertNil(mediaPlayerProvider.playerState(for: audioPlayerStateId))
|
||||
@@ -36,7 +36,7 @@ class MediaPlayerProviderTests: XCTestCase {
|
||||
XCTAssertNil(mediaPlayerProvider.playerState(for: audioPlayerStateId))
|
||||
}
|
||||
|
||||
func testDetachAllStates() async throws {
|
||||
func testDetachAllStates() {
|
||||
let audioPlayer = AudioPlayerMock()
|
||||
audioPlayer.actions = PassthroughSubject<AudioPlayerAction, Never>().eraseToAnyPublisher()
|
||||
|
||||
@@ -55,7 +55,7 @@ class MediaPlayerProviderTests: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testDetachAllStatesWithException() async throws {
|
||||
func testDetachAllStatesWithException() {
|
||||
let audioPlayer = AudioPlayerMock()
|
||||
audioPlayer.actions = PassthroughSubject<AudioPlayerAction, Never>().eraseToAnyPublisher()
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import Kingfisher
|
||||
import XCTest
|
||||
|
||||
@@ -68,7 +67,7 @@ final class MediaProviderTests: XCTestCase {
|
||||
XCTAssertNil(result)
|
||||
}
|
||||
|
||||
func test_whenImageFromSourceWithSourceNil_nilReturned() throws {
|
||||
func test_whenImageFromSourceWithSourceNil_nilReturned() {
|
||||
let image = mediaProvider.imageFromSource(nil, size: Avatars.Size.room(on: .timeline).scaledSize)
|
||||
XCTAssertNil(image)
|
||||
}
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class MediaUploadPreviewScreenViewModelTests: XCTestCase {
|
||||
@@ -17,7 +16,9 @@ class MediaUploadPreviewScreenViewModelTests: XCTestCase {
|
||||
var userIndicatorController: UserIndicatorControllerMock!
|
||||
|
||||
var viewModel: MediaUploadPreviewScreenViewModel!
|
||||
var context: MediaUploadPreviewScreenViewModel.Context { viewModel.context }
|
||||
var context: MediaUploadPreviewScreenViewModel.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
enum TestError: Swift.Error {
|
||||
case unexpectedParameter
|
||||
@@ -223,10 +224,22 @@ class MediaUploadPreviewScreenViewModelTests: XCTestCase {
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private var audioURL: URL { assertResourceURL(filename: "test_audio.mp3") }
|
||||
private var fileURL: URL { assertResourceURL(filename: "test_pdf.pdf") }
|
||||
private var imageURL: URL { assertResourceURL(filename: "test_animated_image.gif") }
|
||||
private var videoURL: URL { assertResourceURL(filename: "landscape_test_video.mov") }
|
||||
private var audioURL: URL {
|
||||
assertResourceURL(filename: "test_audio.mp3")
|
||||
}
|
||||
|
||||
private var fileURL: URL {
|
||||
assertResourceURL(filename: "test_pdf.pdf")
|
||||
}
|
||||
|
||||
private var imageURL: URL {
|
||||
assertResourceURL(filename: "test_animated_image.gif")
|
||||
}
|
||||
|
||||
private var videoURL: URL {
|
||||
assertResourceURL(filename: "landscape_test_video.mov")
|
||||
}
|
||||
|
||||
private var badImageURL = URL(filePath: "/home/user/this_file_doesn't_exist.jpg")
|
||||
|
||||
private func assertResourceURL(filename: String) -> URL {
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import UniformTypeIdentifiers
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
final class MediaUploadingPreprocessorTests: XCTestCase {
|
||||
let maxUploadSize: UInt = 100 * 1024 * 1024
|
||||
var appSettings: AppSettings!
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class MessageForwardingScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class NavigationRootCoordinatorTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class NavigationSplitCoordinatorTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class NavigationStackCoordinatorTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class NavigationTabCoordinatorTests: XCTestCase {
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
//
|
||||
|
||||
import Dynamic
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
final class NotificationContentBuilderTests: XCTestCase {
|
||||
var notificationContentBuilder: NotificationContentBuilder!
|
||||
var mediaProvider: MediaProviderMock!
|
||||
|
||||
@@ -13,6 +13,11 @@ final class MockCoder: NSKeyedArchiver {
|
||||
finishEncoding()
|
||||
}
|
||||
|
||||
override func decodeObject(forKey _: String) -> Any { "" }
|
||||
override func decodeInt64(forKey key: String) -> Int64 { 0 }
|
||||
override func decodeObject(forKey _: String) -> Any {
|
||||
""
|
||||
}
|
||||
|
||||
override func decodeInt64(forKey key: String) -> Int64 {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import NotificationCenter
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
final class NotificationManagerTests: XCTestCase {
|
||||
var notificationManager: NotificationManager!
|
||||
@@ -24,7 +23,9 @@ final class NotificationManagerTests: XCTestCase {
|
||||
private var notificationTappedDelegateCalled = false
|
||||
private var registerForRemoteNotificationsDelegateCalled: (() -> Void)?
|
||||
|
||||
private var appSettings: AppSettings { ServiceLocator.shared.settings }
|
||||
private var appSettings: AppSettings {
|
||||
ServiceLocator.shared.settings
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
AppSettings.resetAllSettings()
|
||||
@@ -49,12 +50,12 @@ final class NotificationManagerTests: XCTestCase {
|
||||
XCTAssertTrue(clientProxy.setPusherWithCalled)
|
||||
}
|
||||
|
||||
func test_whenRegisteredSuccess_completionSuccessIsCalled() async throws {
|
||||
func test_whenRegisteredSuccess_completionSuccessIsCalled() async {
|
||||
let success = await notificationManager.register(with: Data())
|
||||
XCTAssertTrue(success)
|
||||
}
|
||||
|
||||
func test_whenRegisteredAndPusherThrowsError_completionFalseIsCalled() async throws {
|
||||
func test_whenRegisteredAndPusherThrowsError_completionFalseIsCalled() async {
|
||||
enum TestError: Error {
|
||||
case someError
|
||||
}
|
||||
@@ -92,13 +93,13 @@ final class NotificationManagerTests: XCTestCase {
|
||||
XCTAssertEqual(data.defaultPayload, try defaultPayload.toJsonString())
|
||||
}
|
||||
|
||||
func test_whenRegisteredAndPusherTagNotSetInSettings_tagGeneratedAndSavedInSettings() async throws {
|
||||
func test_whenRegisteredAndPusherTagNotSetInSettings_tagGeneratedAndSavedInSettings() async {
|
||||
appSettings.pusherProfileTag = nil
|
||||
_ = await notificationManager.register(with: Data())
|
||||
XCTAssertNotNil(appSettings.pusherProfileTag)
|
||||
}
|
||||
|
||||
func test_whenRegisteredAndPusherTagIsSetInSettings_tagNotGenerated() async throws {
|
||||
func test_whenRegisteredAndPusherTagIsSetInSettings_tagNotGenerated() async {
|
||||
appSettings.pusherProfileTag = "12345"
|
||||
_ = await notificationManager.register(with: Data())
|
||||
XCTAssertEqual(appSettings.pusherProfileTag, "12345")
|
||||
@@ -111,7 +112,7 @@ final class NotificationManagerTests: XCTestCase {
|
||||
XCTAssertEqual(request.content.subtitle, "Subtitle")
|
||||
}
|
||||
|
||||
func test_whenStart_notificationCategoriesAreSet() throws {
|
||||
func test_whenStart_notificationCategoriesAreSet() {
|
||||
let replyAction = UNTextInputNotificationAction(identifier: NotificationConstants.Action.inlineReply,
|
||||
title: L10n.actionQuickReply,
|
||||
options: [])
|
||||
@@ -132,7 +133,7 @@ final class NotificationManagerTests: XCTestCase {
|
||||
XCTAssertTrue(delegate.isEqual(notificationManager))
|
||||
}
|
||||
|
||||
func test_whenStart_requestAuthorizationCalledWithCorrectParams() async throws {
|
||||
func test_whenStart_requestAuthorizationCalledWithCorrectParams() async {
|
||||
let expectation = expectation(description: "requestAuthorization should be called")
|
||||
notificationCenter.requestAuthorizationOptionsClosure = { _ in
|
||||
expectation.fulfill()
|
||||
@@ -143,7 +144,7 @@ final class NotificationManagerTests: XCTestCase {
|
||||
XCTAssertEqual(notificationCenter.requestAuthorizationOptionsReceivedOptions, [.alert, .sound, .badge])
|
||||
}
|
||||
|
||||
func test_whenStartAndAuthorizationGranted_delegateCalled() async throws {
|
||||
func test_whenStartAndAuthorizationGranted_delegateCalled() async {
|
||||
authorizationStatusWasGranted = false
|
||||
notificationManager.delegate = self
|
||||
let expectation: XCTestExpectation = expectation(description: "registerForRemoteNotifications delegate function should be called")
|
||||
@@ -167,7 +168,7 @@ final class NotificationManagerTests: XCTestCase {
|
||||
XCTAssertFalse(authorizationStatusWasGranted)
|
||||
}
|
||||
|
||||
func test_whenStartAndAuthorized_registerForRemoteNotificationsCalled() async throws {
|
||||
func test_whenStartAndAuthorized_registerForRemoteNotificationsCalled() async {
|
||||
appSettings.enableNotifications = true
|
||||
notificationCenter.authorizationStatusReturnValue = .authorized
|
||||
notificationManager.delegate = self
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class NotificationSettingsEditScreenViewModelTests: XCTestCase {
|
||||
private var viewModel: NotificationSettingsEditScreenViewModelProtocol!
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class NotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
private var viewModel: NotificationSettingsScreenViewModelProtocol!
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class PillContextTests: XCTestCase {
|
||||
@@ -228,7 +227,7 @@ class PillContextTests: XCTestCase {
|
||||
XCTAssertEqual(context.viewState.displayText, "💬 > 1")
|
||||
}
|
||||
|
||||
func testEventOnRoomAliasMention() async throws {
|
||||
func testEventOnRoomAliasMention() {
|
||||
let proxyMock = JoinedRoomProxyMock(.init())
|
||||
let mockController = MockTimelineController()
|
||||
mockController.roomProxy = proxyMock
|
||||
@@ -254,7 +253,7 @@ class PillContextTests: XCTestCase {
|
||||
XCTAssertEqual(context.viewState.displayText, "💬 > #Foundation and Empire")
|
||||
}
|
||||
|
||||
func testEventOnRoomAliasMentionMissingRoom() async throws {
|
||||
func testEventOnRoomAliasMentionMissingRoom() {
|
||||
let proxyMock = JoinedRoomProxyMock(.init())
|
||||
let mockController = MockTimelineController()
|
||||
mockController.roomProxy = proxyMock
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
class PinnedEventsBannerStateTests: XCTestCase {
|
||||
func testEmpty() {
|
||||
|
||||
@@ -6,16 +6,17 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class PollFormScreenViewModelTests: XCTestCase {
|
||||
let timelineProxy = TimelineProxyMock(.init())
|
||||
|
||||
var viewModel: PollFormScreenViewModelProtocol!
|
||||
var context: PollFormScreenViewModelType.Context { viewModel.context }
|
||||
var context: PollFormScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
func testNewPollInitialState() async throws {
|
||||
setupViewModel()
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDKMocks
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
final class QRCodeLoginScreenViewModelTests: XCTestCase {
|
||||
@@ -24,7 +23,9 @@ final class QRCodeLoginScreenViewModelTests: XCTestCase {
|
||||
private var appMediator: AppMediatorMock!
|
||||
|
||||
private var viewModel: QRCodeLoginScreenViewModelProtocol!
|
||||
private var context: QRCodeLoginScreenViewModelType.Context { viewModel.context }
|
||||
private var context: QRCodeLoginScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
func testLoginInitialState() {
|
||||
setupViewModel(mode: .login)
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
class RemotePreferenceTests: XCTestCase {
|
||||
func testOverrideAndReset() {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class ReportRoomScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,15 +6,16 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class ResolveVerifiedUserSendFailureScreenViewModelTests: XCTestCase {
|
||||
let roomProxy = JoinedRoomProxyMock(.init())
|
||||
var viewModel: ResolveVerifiedUserSendFailureScreenViewModel!
|
||||
var context: ResolveVerifiedUserSendFailureScreenViewModel.Context { viewModel.context }
|
||||
var context: ResolveVerifiedUserSendFailureScreenViewModel.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
func testUnsignedDevice() async throws {
|
||||
// Given a failure where a single user has an unverified device
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
class RestorationTokenTests: XCTestCase {
|
||||
func testDecodeTokenWithSlidingSyncProxy() throws {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomChangePermissionsScreenViewModelTests: XCTestCase {
|
||||
@@ -92,7 +91,7 @@ class RoomChangePermissionsScreenViewModelTests: XCTestCase {
|
||||
"Only the avatar setting should be applied. No other settings were changed so they should be nil to remain left alone.")
|
||||
}
|
||||
|
||||
func testSaveNoChanges() async throws {
|
||||
func testSaveNoChanges() {
|
||||
setUp(isSpace: false)
|
||||
// Given a screen with no changes.
|
||||
XCTAssertFalse(context.viewState.hasChanges)
|
||||
@@ -104,7 +103,7 @@ class RoomChangePermissionsScreenViewModelTests: XCTestCase {
|
||||
XCTAssertFalse(roomProxy.applyPowerLevelChangesCalled)
|
||||
}
|
||||
|
||||
func testDefaultStateRoom() async throws {
|
||||
func testDefaultStateRoom() {
|
||||
setUp(isSpace: false)
|
||||
XCTAssertNotNil(context.settings[.roomDetails])
|
||||
XCTAssertNotNil(context.settings[.memberModeration])
|
||||
@@ -112,7 +111,7 @@ class RoomChangePermissionsScreenViewModelTests: XCTestCase {
|
||||
XCTAssertNil(context.settings[.manageSpace])
|
||||
}
|
||||
|
||||
func testDefaultStateSpace() async throws {
|
||||
func testDefaultStateSpace() {
|
||||
setUp(isSpace: true)
|
||||
XCTAssertNotNil(context.settings[.roomDetails])
|
||||
XCTAssertNotNil(context.settings[.memberModeration])
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomChangeRolesScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class RoomDetailsEditScreenViewModelTests: XCTestCase {
|
||||
var viewModel: RoomDetailsEditScreenViewModel!
|
||||
@@ -134,7 +133,7 @@ class RoomDetailsEditScreenViewModelTests: XCTestCase {
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
func testErrorShownOnFailedFetchOfMedia() async throws {
|
||||
func testErrorShownOnFailedFetchOfMedia() async {
|
||||
setupViewModel(roomProxyConfiguration: .init(name: "Some room", members: [.mockMeAdmin]))
|
||||
viewModel.didSelectMediaUrl(url: .picturesDirectory)
|
||||
try? await Task.sleep(for: .milliseconds(100))
|
||||
|
||||
@@ -8,18 +8,20 @@
|
||||
|
||||
import AsyncAlgorithms
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import SwiftUI
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
var viewModel: RoomDetailsScreenViewModel!
|
||||
var roomProxyMock: JoinedRoomProxyMock!
|
||||
var notificationSettingsProxyMock: NotificationSettingsProxyMock!
|
||||
var context: RoomDetailsScreenViewModelType.Context { viewModel.context }
|
||||
var context: RoomDetailsScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
var cancellables = Set<AnyCancellable>()
|
||||
|
||||
override func setUp() {
|
||||
@@ -75,7 +77,7 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
XCTAssertEqual(context.viewState.bindings.leaveRoomAlertItem?.subtitle, L10n.leaveRoomAlertPrivateSubtitle)
|
||||
}
|
||||
|
||||
func testLeaveRoomTappedWithLessThanTwoMembers() async {
|
||||
func testLeaveRoomTappedWithLessThanTwoMembers() {
|
||||
let mockedMembers: [RoomMemberProxyMock] = [.mockAlice]
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: "Test", members: mockedMembers))
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomDirectorySearchScreenScreenViewModelTests: XCTestCase { }
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import MatrixRustSDKMocks
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomFlowCoordinatorTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
final class RoomListFiltersStateTests: XCTestCase {
|
||||
var appSettings: AppSettings!
|
||||
@@ -108,7 +107,7 @@ final class RoomListFiltersStateTests: XCTestCase {
|
||||
|
||||
// MARK: Low Priority feature flag
|
||||
|
||||
// Don't forget to add .lowPriority into the mix above when enabling the feature.
|
||||
/// Don't forget to add .lowPriority into the mix above when enabling the feature.
|
||||
func testWithLowPriorityFeature() {
|
||||
enableLowPriorityFeature()
|
||||
XCTAssertFalse(state.isFiltering)
|
||||
|
||||
@@ -6,16 +6,17 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomMemberDetailsViewModelTests: XCTestCase {
|
||||
var viewModel: RoomMemberDetailsScreenViewModelProtocol!
|
||||
var roomProxyMock: JoinedRoomProxyMock!
|
||||
var roomMemberProxyMock: RoomMemberProxyMock!
|
||||
var context: RoomMemberDetailsScreenViewModelType.Context { viewModel.context }
|
||||
var context: RoomMemberDetailsScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
override func setUp() async throws {
|
||||
roomProxyMock = JoinedRoomProxyMock(.init(name: ""))
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomMembersFlowCoordinatorTests: XCTestCase {
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomMembersListScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class RoomNotificationSettingsScreenViewModelTests: XCTestCase {
|
||||
var roomProxyMock: JoinedRoomProxyMock!
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
class RoomPermissionsTests: XCTestCase {
|
||||
func testFromRust() {
|
||||
// Given a set of power level changes with various values.
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomPollsHistoryScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomRolesAndPermissionsScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import MatrixRustSDKMocks
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import MatrixRustSDKMocks
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
final class RoomSummaryProviderTests: XCTestCase {
|
||||
var appSettings: AppSettings!
|
||||
var roomList: RoomListSDKMock!
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
class RoomSummaryTests: XCTestCase {
|
||||
// swiftlint:disable:next large_tuple
|
||||
|
||||
@@ -6,14 +6,13 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import MatrixRustSDKMocks
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
class RoomTests: XCTestCase {
|
||||
func testCallIntent() async throws {
|
||||
func testCallIntent() async {
|
||||
let room = RoomSDKMock()
|
||||
room.hasActiveRoomCallReturnValue = false
|
||||
room.isDirectReturnValue = false
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SecureBackupKeyBackupScreenViewModelTests: XCTestCase { }
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SecureBackupLogoutConfirmationScreenViewModelTests: XCTestCase {
|
||||
var viewModel: SecureBackupLogoutConfirmationScreenViewModel!
|
||||
var context: SecureBackupLogoutConfirmationScreenViewModel.Context { viewModel.context }
|
||||
var context: SecureBackupLogoutConfirmationScreenViewModel.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
var secureBackupController: SecureBackupControllerMock!
|
||||
var reachabilitySubject: CurrentValueSubject<NetworkMonitorReachability, Never>!
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SecureBackupRecoveryKeyScreenViewModelTests: XCTestCase { }
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SecureBackupScreenViewModelTests: XCTestCase { }
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
@testable import ElementX
|
||||
import MatrixRustSDK
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class SecurityAndPrivacyScreenViewModelTests: XCTestCase {
|
||||
var viewModel: SecurityAndPrivacyScreenViewModelProtocol!
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class ServerConfirmationScreenViewStateTests: XCTestCase {
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import MatrixRustSDKMocks
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
|
||||
@MainActor
|
||||
class ServerConfirmationScreenViewModelTests: XCTestCase {
|
||||
var clientFactory: AuthenticationClientFactoryMock!
|
||||
@@ -19,7 +18,9 @@ class ServerConfirmationScreenViewModelTests: XCTestCase {
|
||||
var appSettings: AppSettings!
|
||||
|
||||
var viewModel: ServerConfirmationScreenViewModel!
|
||||
var context: ServerConfirmationScreenViewModel.Context { viewModel.context }
|
||||
var context: ServerConfirmationScreenViewModel.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
AppSettings.resetAllSettings()
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class ServerSelectionScreenViewModelTests: XCTestCase {
|
||||
@@ -16,7 +15,9 @@ class ServerSelectionScreenViewModelTests: XCTestCase {
|
||||
var service: AuthenticationServiceProtocol!
|
||||
|
||||
var viewModel: ServerSelectionScreenViewModelProtocol!
|
||||
var context: ServerSelectionScreenViewModelType.Context { viewModel.context }
|
||||
var context: ServerSelectionScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
func testSelectForLogin() async throws {
|
||||
// Given a view model for login.
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
class SessionDirectoriesTests: XCTestCase {
|
||||
let fileManager = FileManager.default
|
||||
@@ -93,9 +92,17 @@ class SessionDirectoriesTests: XCTestCase {
|
||||
}
|
||||
|
||||
private extension SessionDirectories {
|
||||
var mockStateStorePath: String { dataDirectory.appending(component: "matrix-sdk-state.sqlite3").path(percentEncoded: false) }
|
||||
var mockCryptoStorePath: String { dataDirectory.appending(component: "matrix-sdk-crypto.sqlite3").path(percentEncoded: false) }
|
||||
var mockEventCachePath: String { cacheDirectory.appending(component: "matrix-sdk-event-cache.sqlite3").path(percentEncoded: false) }
|
||||
var mockStateStorePath: String {
|
||||
dataDirectory.appending(component: "matrix-sdk-state.sqlite3").path(percentEncoded: false)
|
||||
}
|
||||
|
||||
var mockCryptoStorePath: String {
|
||||
dataDirectory.appending(component: "matrix-sdk-crypto.sqlite3").path(percentEncoded: false)
|
||||
}
|
||||
|
||||
var mockEventCachePath: String {
|
||||
cacheDirectory.appending(component: "matrix-sdk-event-cache.sqlite3").path(percentEncoded: false)
|
||||
}
|
||||
|
||||
func generateMockData() {
|
||||
generateMockDatabase(atPath: mockStateStorePath)
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SessionVerificationStateMachineTests: XCTestCase {
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SessionVerificationViewModelTests: XCTestCase {
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SettingsScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SoftLogoutScreenViewModelTests: XCTestCase {
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
//
|
||||
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import ElementX
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class SpaceAddRoomsScreenViewModelTests: XCTestCase {
|
||||
@@ -17,7 +16,9 @@ class SpaceAddRoomsScreenViewModelTests: XCTestCase {
|
||||
var spaceServiceProxy: SpaceServiceProxyMock!
|
||||
|
||||
var viewModel: SpaceAddRoomsScreenViewModelProtocol!
|
||||
var context: SpaceAddRoomsScreenViewModelType.Context { viewModel.context }
|
||||
var context: SpaceAddRoomsScreenViewModelType.Context {
|
||||
viewModel.context
|
||||
}
|
||||
|
||||
func testAddingChildRoom() async throws {
|
||||
setupViewModel()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user