File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
WooCommerce/WooCommerceTests/ViewRelated/Products/Media Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -168,4 +168,29 @@ final class ProductImageUploaderTests: XCTestCase {
168168 isLocalID: false ,
169169 originalStatuses: [ ] ) . productImageStatuses)
170170 }
171+
172+ func test_calling_replaceLocalID_with_nonExistent_localProductID_does_nothing( ) {
173+ // Given
174+ let imageUploader = ProductImageUploader ( )
175+ let localProductID : Int64 = 0
176+ let nonExistentProductID : Int64 = 999
177+ let remoteProductID = productID
178+ let originalStatuses : [ ProductImageStatus ] = [ . remote( image: ProductImage . fake ( ) ) ,
179+ . uploading( asset: PHAsset ( ) ) ,
180+ . uploading( asset: PHAsset ( ) ) ]
181+ _ = imageUploader. actionHandler ( siteID: siteID,
182+ productID: localProductID,
183+ isLocalID: true ,
184+ originalStatuses: originalStatuses)
185+
186+ // When
187+ imageUploader. replaceLocalID ( siteID: siteID, localProductID: nonExistentProductID, remoteProductID: remoteProductID)
188+
189+ // Then
190+ // Ensure that trying to replace a non-existent product ID does nothing.
191+ XCTAssertEqual ( originalStatuses, imageUploader. actionHandler ( siteID: siteID,
192+ productID: localProductID,
193+ isLocalID: true ,
194+ originalStatuses: [ ] ) . productImageStatuses)
195+ }
171196}
You can’t perform that action at this time.
0 commit comments