From ce1a2fff85848746423d06c15fea582f2ea83076 Mon Sep 17 00:00:00 2001 From: kean Date: Sat, 4 May 2024 15:35:06 -0400 Subject: [PATCH] Remove flaky testAsyncEvents (no way to gurantee order) --- .../ImagePipelineAsyncAwaitTests.swift | 41 ------------------- 1 file changed, 41 deletions(-) diff --git a/Tests/NukeTests/ImagePipelineTests/ImagePipelineAsyncAwaitTests.swift b/Tests/NukeTests/ImagePipelineTests/ImagePipelineAsyncAwaitTests.swift index 634699104..8d48987a7 100644 --- a/Tests/NukeTests/ImagePipelineTests/ImagePipelineAsyncAwaitTests.swift +++ b/Tests/NukeTests/ImagePipelineTests/ImagePipelineAsyncAwaitTests.swift @@ -65,47 +65,6 @@ class ImagePipelineAsyncAwaitTests: XCTestCase, @unchecked Sendable { XCTAssertEqual(image.sizeInPixels, CGSize(width: 640, height: 480)) } - @MainActor - @available(macOS 12, iOS 15, tvOS 15, watchOS 9, *) - func testAsyncImageTaskEvents() async throws { - // GIVEN - let dataLoader = MockProgressiveDataLoader() - pipeline = pipeline.reconfigured { - $0.dataLoader = dataLoader - $0.isProgressiveDecodingEnabled = true - } - pipeline.queue.suspend() - // TODO: Find a more reliable way to subscribe to events - DispatchQueue.global.asyncAfter(deadline: .now() + .milliseconds(64)) { - self.pipeline.queue.resume() // Make sure we subscribe after a delay - } - - // WHEN - let task = pipeline.imageTask(with: Test.url) - for await event in task.events.values { - switch event { - case .preview(let response): - recordedPreviews.append(response) - dataLoader.resume() - case .finished(let result): - recordedResult = result - default: - break - } - recordedEvents.append(event) - } - - // THEN - XCTAssertEqual(recordedEvents, [ - .progress(.init(completed: 13152, total: 39456)), - .preview(recordedPreviews[0]), - .progress(.init(completed: 26304, total: 39456)), - .preview(recordedPreviews[1]), - .progress(.init(completed: 39456, total: 39456)), - .finished(try XCTUnwrap(recordedResult)) - ]) - } - private var observer: AnyObject? // MARK: - Cancellation