Skip to content

Commit

Permalink
Also observe .didChange in ProfileManager tests
Browse files Browse the repository at this point in the history
Remote import may not trigger objectWillChange, observe any of
the two.
  • Loading branch information
keeshux committed Nov 23, 2024
1 parent 6cccd50 commit d374a1b
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,17 +711,21 @@ private extension ProfileManagerTests {
) async throws {
let exp = expectation(description: description)
var wasMet = false
sut.objectWillChange
.sink {
guard !wasMet else {
return
}
if condition(sut) {
wasMet = true
exp.fulfill()
}

Publishers.Merge(
sut.objectWillChange,
sut.didChange.map { _ in }
)
.sink {
guard !wasMet else {
return
}
.store(in: &subscriptions)
if condition(sut) {
wasMet = true
exp.fulfill()
}
}
.store(in: &subscriptions)

try await action(sut)
await fulfillment(of: [exp], timeout: timeout)
Expand Down

0 comments on commit d374a1b

Please sign in to comment.