Hopefully fix the flakey unignoreFailure RoomDetailsScreenViewModelTests

This commit is contained in:
Stefan Ceriu
2026-08-20 11:35:17 +03:00
parent 0bd571d068
commit 72d55e485a
@@ -271,13 +271,15 @@ struct RoomDetailsScreenViewModelTests {
#expect(context.viewState.dmRecipientInfo?.member == RoomMemberDetails(withProxy: recipient))
#expect(!context.viewState.isProcessingIgnoreRequest)
let deferredProcessing = deferFulfillment(viewModel.context.observe(\.viewState.isProcessingIgnoreRequest),
transitionValues: [true, false])
// Waiting on the transient isProcessingIgnoreRequest transition races the view model's task,
// which can complete before the observation starts. Wait on the alert instead.
let deferredAlert = deferFulfillment(context.observe(\.alertInfo)) { $0 != nil }
context.send(viewAction: .unignoreConfirmed)
try await deferredProcessing.fulfill()
try await deferredAlert.fulfill()
#expect(!context.viewState.isProcessingIgnoreRequest)
#expect(context.viewState.dmRecipientInfo?.member.isIgnored == true)
#expect(context.alertInfo != nil)
}