Skip to content

Commit

Permalink
Fix flaky testCancelAsyncImageTask
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Apr 21, 2024
1 parent 3776cae commit e4d214f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ class ImagePipelineAsyncAwaitTests: XCTestCase, @unchecked Sendable {
func testCancelAsyncImageTask() async throws {
dataLoader.queue.isSuspended = true

pipeline.queue.suspend()
let task = pipeline.imageTask(with: Test.url)

observer = NotificationCenter.default.addObserver(forName: MockDataLoader.DidStartTask, object: dataLoader, queue: OperationQueue()) { _ in
task.cancel()
}
pipeline.queue.resume()

var caughtError: Error?
do {
Expand Down

0 comments on commit e4d214f

Please sign in to comment.