mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add xcDeferFulfillment to help with tests that have publishers. (#1278)
* Add xcAwaitDeferred to aid with tests that have publishers. * Improve naming * Address Comments - Fix naming - Add optional expectation message - Use trailing closure syntax
This commit is contained in:
@@ -87,8 +87,9 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
let room: RoomProxyMock = .init(with: .init(id: mockRoomId, displayName: "Some room"))
|
||||
room.leaveRoomClosure = { .failure(.failedLeavingRoom) }
|
||||
clientProxy.roomForIdentifierMocks[mockRoomId] = room
|
||||
let deferred = deferFulfillment(context.$viewState.first(), message: "viewState should be published.")
|
||||
context.send(viewAction: .confirmLeaveRoom(roomIdentifier: mockRoomId))
|
||||
await context.nextViewState()
|
||||
try await deferred.fulfill()
|
||||
XCTAssertNotNil(context.alertInfo)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user