metatext/Tests/View Models/RootViewModelTests.swift

25 lines
710 B
Swift
Raw Normal View History

2020-08-03 15:20:51 +00: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())
2020-08-04 20:26:09 +00:00
let recorder = sut.$mainNavigationViewModel.record()
2020-08-03 15:20:51 +00:00
2020-08-04 20:26:09 +00:00
XCTAssertNil(try wait(for: recorder.next(), timeout: 1))
2020-08-03 15:20:51 +00:00
let addIdentityViewModel = sut.addIdentityViewModel()
addIdentityViewModel.urlFieldText = "https://mastodon.social"
addIdentityViewModel.goTapped()
2020-08-04 20:26:09 +00:00
let mainNavigationViewModel = try wait(for: recorder.next(), timeout: 1)!
2020-08-03 15:20:51 +00:00
2020-08-04 20:26:09 +00:00
XCTAssertNotNil(mainNavigationViewModel)
2020-08-03 15:20:51 +00:00
}
}