mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Fix various flakey unit tests (#1783)
* Fix flakey emoji provider tests * Fix flakey RoomScreenViewModel tests * Fix flakey HomeScreenViewModel tests * Fix flakey RoomMemberListScreen tests, problem with bindings getting overriden and deferFulfillment cancellable not getting stored * Fix flakey RoomNotificationSettingsScreen tests and crashes * Fix flakey RoomMemberDetailsScreen tests * Deprecate old `deferFulfillment` and `nextViewState` methods * Convert more files to the new `deferFulfillment` * Converted the rest of the tests to the new deferFulfillment * Removed now unused `nextViewState` and `deferFulfillment` * Remove automatic retries from unit tests * Reset analytics flag after running unit tests * Address PR comments * Introduce a new `deferFulfillment(publisher, keyPath, transitionValues)` method and use it where appropiate
This commit is contained in:
@@ -119,17 +119,22 @@ class RoomFlowCoordinatorTests: XCTestCase {
|
||||
}
|
||||
|
||||
private func process(route: AppRoute, expectedActions: [RoomFlowCoordinatorAction]) async throws {
|
||||
let deferred = deferFulfillment(roomFlowCoordinator.actions.collect(expectedActions.count).first(),
|
||||
message: "The expected number of actions should be published.")
|
||||
|
||||
Task {
|
||||
await Task.yield()
|
||||
self.roomFlowCoordinator.handleAppRoute(route, animated: true)
|
||||
guard !expectedActions.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
if !expectedActions.isEmpty {
|
||||
let actions = try await deferred.fulfill()
|
||||
XCTAssertEqual(actions, expectedActions)
|
||||
var fulfillments = [DeferredFulfillment<RoomFlowCoordinatorAction>]()
|
||||
|
||||
for expectedAction in expectedActions {
|
||||
fulfillments.append(deferFulfillment(roomFlowCoordinator.actions) { action in
|
||||
action == expectedAction
|
||||
})
|
||||
}
|
||||
|
||||
roomFlowCoordinator.handleAppRoute(route, animated: true)
|
||||
|
||||
for fulfillment in fulfillments {
|
||||
try await fulfillment.fulfill()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user