ios/BitwardenShared/UI/Auth/StartRegistration/CheckEmail/CheckEmailView+ViewInspectorTests.swift
Federico Maccaroni 07176cd3c0
[PM-14425] [BEEEP] Add test plans (#1106)
Co-authored-by: Katherine Bertelsen <kbertelsen@bitwarden.com>
2025-10-10 14:03:19 -03:00

50 lines
1.4 KiB
Swift

// swiftlint:disable:this file_name
import BitwardenResources
import SwiftUI
import ViewInspector
import XCTest
@testable import BitwardenShared
// MARK: - CheckEmailViewTests
class CheckEmailViewTests: BitwardenTestCase {
// MARK: Properties
var processor: MockProcessor<CheckEmailState, CheckEmailAction, Void>!
var subject: CheckEmailView!
// MARK: Setup & Teardown
override func setUp() {
super.setUp()
processor = MockProcessor(state: CheckEmailState(email: "example@email.com"))
let store = Store(processor: processor)
subject = CheckEmailView(store: store)
}
override func tearDown() {
super.tearDown()
processor = nil
subject = nil
}
// MARK: Tests
/// Tapping the cancel button dispatches the `.dismiss` action.
@MainActor
func test_cancelButton_tap() throws {
let button = try subject.inspect().findCancelToolbarButton()
try button.tap()
XCTAssertEqual(processor.dispatchedActions.last, .dismissTapped)
}
/// Tapping the change email address button dispatches the `.goBackTapped` action.
@MainActor
func test_changeEmailAddressButton_tap() throws {
let button = try subject.inspect().find(button: Localizations.changeEmailAddress)
try button.tap()
XCTAssertEqual(processor.dispatchedActions.last, .goBackTapped)
}
}