@@ -8,45 +8,42 @@ import EssentialFeed
88@MainActor
99class CoreDataFeedImageDataStoreTests : XCTestCase , FeedImageDataStoreSpecs {
1010
11- func test_retrieveImageData_deliversNotFoundWhenEmpty( ) throws {
12- try makeSUT { sut, imageDataURL in
11+ func test_retrieveImageData_deliversNotFoundWhenEmpty( ) async throws {
12+ try await makeSUT { sut, imageDataURL in
1313 assertThatRetrieveImageDataDeliversNotFoundOnEmptyCache ( on: sut, imageDataURL: imageDataURL)
1414 }
1515 }
1616
17- func test_retrieveImageData_deliversNotFoundWhenStoredDataURLDoesNotMatch( ) throws {
18- try makeSUT { sut, imageDataURL in
17+ func test_retrieveImageData_deliversNotFoundWhenStoredDataURLDoesNotMatch( ) async throws {
18+ try await makeSUT { sut, imageDataURL in
1919 assertThatRetrieveImageDataDeliversNotFoundWhenStoredDataURLDoesNotMatch ( on: sut, imageDataURL: imageDataURL)
2020 }
2121 }
2222
23- func test_retrieveImageData_deliversFoundDataWhenThereIsAStoredImageDataMatchingURL( ) throws {
24- try makeSUT { sut, imageDataURL in
23+ func test_retrieveImageData_deliversFoundDataWhenThereIsAStoredImageDataMatchingURL( ) async throws {
24+ try await makeSUT { sut, imageDataURL in
2525 assertThatRetrieveImageDataDeliversFoundDataWhenThereIsAStoredImageDataMatchingURL ( on: sut, imageDataURL: imageDataURL)
2626 }
2727 }
2828
29- func test_retrieveImageData_deliversLastInsertedValue( ) throws {
30- try makeSUT { sut, imageDataURL in
29+ func test_retrieveImageData_deliversLastInsertedValue( ) async throws {
30+ try await makeSUT { sut, imageDataURL in
3131 assertThatRetrieveImageDataDeliversLastInsertedValueForURL ( on: sut, imageDataURL: imageDataURL)
3232 }
3333 }
3434
3535 // - MARK: Helpers
3636
37- private func makeSUT( _ test: @Sendable @escaping ( CoreDataFeedStore , URL ) -> Void , file: StaticString = #filePath, line: UInt = #line) throws {
37+ private func makeSUT( _ test: @Sendable @escaping ( CoreDataFeedStore , URL ) -> Void , file: StaticString = #filePath, line: UInt = #line) async throws {
3838 let storeURL = URL ( fileURLWithPath: " /dev/null " )
3939 let sut = try CoreDataFeedStore ( storeURL: storeURL)
4040 trackForMemoryLeaks ( sut, file: file, line: line)
4141
42- let exp = expectation ( description: " wait for operation " )
43- sut. perform {
42+ await sut. perform {
4443 let imageDataURL = URL ( string: " http://a-url.com " ) !
4544 insertFeedImage ( with: imageDataURL, into: sut, file: file, line: line)
4645 test ( sut, imageDataURL)
47- exp. fulfill ( )
4846 }
49- wait ( for: [ exp] , timeout: 0.1 )
5047 }
5148
5249}
0 commit comments