metatext-app-ios-iphone-ipad/Tests/View Models/RootViewModelTests.swift

25 lines
701 B
Swift
Raw Normal View History

2020-08-03 17:20:51 +02:00
// Copyright © 2020 Metabolist. All rights reserved.
import XCTest
import Combine
import CombineExpectations
@testable import Metatext
class RootViewModelTests: XCTestCase {
func testAddIdentity() throws {
let sut = RootViewModel(environment: .fresh())
let identityIDRecorder = sut.$identityID.record()
XCTAssertNil(try wait(for: identityIDRecorder.next(), timeout: 1))
let addIdentityViewModel = sut.addIdentityViewModel()
addIdentityViewModel.urlFieldText = "https://mastodon.social"
addIdentityViewModel.goTapped()
let identityID = try wait(for: identityIDRecorder.next(), timeout: 1)!
XCTAssertNotNil(identityID)
}
}