Skip to content

Commit 2f9273e

Browse files
committed
test: relax notification expectation fulfillment
1 parent 239bb0b commit 2f9273e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

SimmerTests/MonitoringTests/LogMonitorTests.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,12 @@ internal final class LogMonitorTests: XCTestCase {
6767
let queue = bundle.queue
6868

6969
let notificationExpectation = expectation(description: "patterns change broadcast")
70-
var observer: NSObjectProtocol?
71-
observer = notificationCenter.addObserver(
70+
notificationExpectation.assertForOverFulfill = false
71+
let observer = notificationCenter.addObserver(
7272
forName: .logMonitorPatternsDidChange,
7373
object: nil,
7474
queue: .main
7575
) { _ in
76-
if let token = observer {
77-
notificationCenter.removeObserver(token)
78-
observer = nil
79-
}
8076
notificationExpectation.fulfill()
8177
}
8278

@@ -94,6 +90,8 @@ internal final class LogMonitorTests: XCTestCase {
9490

9591
await fulfillment(of: [alertExpectation, notificationExpectation], timeout: 1.0)
9692

93+
notificationCenter.removeObserver(observer)
94+
9795
let updated = storeRef.loadPatterns().first { $0.id == patternID }
9896
XCTAssertEqual(updated?.enabled, false)
9997

0 commit comments

Comments
 (0)