Skip to content

Commit 3d2970b

Browse files
committed
Add unit tests for unverified and missing destination address
1 parent f9366ee commit 3d2970b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

WooCommerce/WooCommerceTests/ViewRelated/Shipping Label/WooShipping Create Shipping Labels/WooShippingCreateLabelsViewModelTests.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,32 @@ final class WooShippingCreateLabelsViewModelTests: XCTestCase {
473473
// Then
474474
XCTAssertTrue(viewModel.customsInformationIsCompleted)
475475
}
476+
477+
func test_destinationAddressStatus_unverified_and_noticeLabel_set_for_unverified_address() {
478+
// Given
479+
let address = Address.fake().copy(address1: "1 Main Street", city: "San Francisco", state: "CA", postcode: "12345", country: "US")
480+
let order = Order.fake().copy(shippingAddress: address)
481+
482+
// When
483+
let viewModel = WooShippingCreateLabelsViewModel(order: order)
484+
485+
// Then
486+
XCTAssertEqual(viewModel.destinationAddressStatus, .unverified)
487+
XCTAssertNotNil(viewModel.destinationAddressStatusNoticeLabel)
488+
}
489+
490+
func test_destinationAddressStatus_missing_and_noticeLabel_set_for_empty_address() {
491+
// Given
492+
let destinationAddress = Address.fake()
493+
let order = Order.fake().copy(shippingAddress: destinationAddress)
494+
495+
// When
496+
let viewModel = WooShippingCreateLabelsViewModel(order: order)
497+
498+
// Then
499+
XCTAssertEqual(viewModel.destinationAddressStatus, .missing)
500+
XCTAssertNotNil(viewModel.destinationAddressStatusNoticeLabel)
501+
}
476502
}
477503

478504
private extension WooShippingCreateLabelsViewModelTests {

0 commit comments

Comments
 (0)