mirror of
https://github.com/bitwarden/ios.git
synced 2025-12-11 23:33:36 -06:00
48 lines
1.2 KiB
Swift
48 lines
1.2 KiB
Swift
import BitwardenKitMocks
|
|
import SwiftUI
|
|
import XCTest
|
|
|
|
@testable import BitwardenShared
|
|
|
|
// MARK: - ExtensionSetupCoordinatorTests
|
|
|
|
class ExtensionSetupCoordinatorTests: BitwardenTestCase {
|
|
// MARK: Properties
|
|
|
|
var stackNavigator: MockStackNavigator!
|
|
var subject: ExtensionSetupCoordinator!
|
|
|
|
// MARK: Setup & Teardown
|
|
|
|
override func setUp() {
|
|
super.setUp()
|
|
|
|
stackNavigator = MockStackNavigator()
|
|
subject = ExtensionSetupCoordinator(
|
|
appExtensionDelegate: MockAppExtensionDelegate(),
|
|
services: ServiceContainer.withMocks(),
|
|
stackNavigator: stackNavigator,
|
|
)
|
|
}
|
|
|
|
override func tearDown() {
|
|
super.tearDown()
|
|
|
|
stackNavigator = nil
|
|
subject = nil
|
|
}
|
|
|
|
// MARK: Tests
|
|
|
|
/// `navigate(to:)` with `.extensionActivation` replaces the stack navigator's stack with the
|
|
/// extension activation view.
|
|
@MainActor
|
|
func test_navigateTo_extensionActivation() throws {
|
|
subject.navigate(to: .extensionActivation(type: .autofillExtension))
|
|
|
|
let action = try XCTUnwrap(stackNavigator.actions.last)
|
|
XCTAssertEqual(action.type, .replaced)
|
|
XCTAssertTrue(action.view is ExtensionActivationView)
|
|
}
|
|
}
|