* Remove support for handling SPA call links. They were a stop-gap solution whilst we were building support for embedded room calling. * Simplify ElementCallConfiguration now that there is only 1 type of call to handle. * Remove the unused overlayModule from NavigationRoomCoordinator.
69 lines
2.0 KiB
Swift
69 lines
2.0 KiB
Swift
//
|
|
// Copyright 2025 Element Creations Ltd.
|
|
// Copyright 2022-2025 New Vector Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
@testable import ElementX
|
|
import Foundation
|
|
import Testing
|
|
|
|
@MainActor
|
|
struct NavigationRootCoordinatorTests {
|
|
private var navigationRootCoordinator: NavigationRootCoordinator
|
|
|
|
init() {
|
|
navigationRootCoordinator = NavigationRootCoordinator()
|
|
}
|
|
|
|
@Test
|
|
func rootChanges() {
|
|
#expect(navigationRootCoordinator.rootCoordinator == nil)
|
|
|
|
let firstRootCoordinator = SomeTestCoordinator()
|
|
navigationRootCoordinator.setRootCoordinator(firstRootCoordinator)
|
|
|
|
assertCoordinatorsEqual(firstRootCoordinator, navigationRootCoordinator.rootCoordinator)
|
|
|
|
let secondRootCoordinator = SomeTestCoordinator()
|
|
navigationRootCoordinator.setRootCoordinator(secondRootCoordinator)
|
|
|
|
assertCoordinatorsEqual(secondRootCoordinator, navigationRootCoordinator.rootCoordinator)
|
|
}
|
|
|
|
// MARK: - Dismissal Callbacks
|
|
|
|
@Test
|
|
func replacementDismissalCallbacks() async {
|
|
#expect(navigationRootCoordinator.rootCoordinator == nil)
|
|
|
|
let rootCoordinator = SomeTestCoordinator()
|
|
|
|
await confirmation("Wait for callback") { confirm in
|
|
navigationRootCoordinator.setRootCoordinator(rootCoordinator) {
|
|
confirm()
|
|
}
|
|
|
|
navigationRootCoordinator.setRootCoordinator(nil)
|
|
}
|
|
}
|
|
|
|
// MARK: - Private
|
|
|
|
private func assertCoordinatorsEqual(_ lhs: CoordinatorProtocol?, _ rhs: CoordinatorProtocol?) {
|
|
guard let lhs = lhs as? SomeTestCoordinator,
|
|
let rhs = rhs as? SomeTestCoordinator else {
|
|
Issue.record("Coordinators are not the same")
|
|
return
|
|
}
|
|
|
|
#expect(lhs.id == rhs.id)
|
|
}
|
|
}
|
|
|
|
private class SomeTestCoordinator: CoordinatorProtocol {
|
|
let id = UUID()
|
|
}
|