From 754d5b9be47d98f4375844bf713596c5dd3bffe4 Mon Sep 17 00:00:00 2001 From: onevcat Date: Fri, 14 Jun 2024 23:11:48 +0900 Subject: [PATCH] Fix tests for non-optional value --- Tests/KingfisherTests/ImageDownloaderTests.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Tests/KingfisherTests/ImageDownloaderTests.swift b/Tests/KingfisherTests/ImageDownloaderTests.swift index 0f2c13a7c..aa41bc643 100644 --- a/Tests/KingfisherTests/ImageDownloaderTests.swift +++ b/Tests/KingfisherTests/ImageDownloaderTests.swift @@ -272,8 +272,8 @@ class ImageDownloaderTests: XCTestCase { delay(0.1) { exp.fulfill() } } - XCTAssertNotNil(task) - task!.cancel() + XCTAssertTrue(task.isInitialized) + task.cancel() _ = stub.go() @@ -412,9 +412,8 @@ class ImageDownloaderTests: XCTestCase { group.leave() } - XCTAssertNotNil(downloadTask) - - downloadTask!.cancel() + XCTAssertTrue(downloadTask.isInitialized) + downloadTask.cancel() _ = stub.go() group.enter()