Add utility to run UI tests for Screen states, add screen states for template and finish unit test.

This commit is contained in:
David Langley
2021-09-10 16:43:31 +01:00
parent 59a54654b1
commit 4fb59260d4
15 changed files with 332 additions and 148 deletions
@@ -38,12 +38,12 @@ class TemplateUserProfileViewModelTests: XCTestCase {
XCTAssertEqual(viewModel.viewState.presence, Constants.presenceInitialValue)
}
func testFirstPresenceRecieved() throws {
func testFirstPresenceReceived() throws {
let presencePublisher = viewModel.$viewState.map(\.presence).removeDuplicates().collect(1).first()
XCTAssertEqual(try xcAwait(presencePublisher), [Constants.presenceInitialValue])
}
func testPresenceUpdatesRecieved() throws {
func testPresenceUpdatesReceived() throws {
let presencePublisher = viewModel.$viewState.map(\.presence).removeDuplicates().collect(3).first()
let newPresenceValue1: TemplateUserProfilePresence = .online
let newPresenceValue2: TemplateUserProfilePresence = .idle