Skip to content

Commit 43e4dca

Browse files
committed
Add a test for empty loginURL
1 parent f20b75f commit 43e4dca

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

WooCommerce/WooCommerceTests/ViewRelated/Products/Edit Product/ProductFormViewModelTests.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,23 @@ final class ProductFormViewModelTests: XCTestCase {
716716
// Then
717717
XCTAssertEqual(actionButtons, [.publish, .more])
718718
}
719+
720+
func test_no_preview_button_for_existing_draft_product_on_site_with_no_preview_url() {
721+
// Given
722+
sessionManager.defaultSite = Site.fake().copy(loginURL: "", isWordPressComStore: true)
723+
724+
let product = Product.fake().copy(productID: 123, statusKey: ProductStatus.draft.rawValue)
725+
let viewModel = createViewModel(product: product,
726+
formType: .edit,
727+
stores: stores,
728+
featureFlagService: MockFeatureFlagService(isProductsOnboardingEnabled: true))
729+
730+
// When
731+
let actionButtons = viewModel.actionButtons
732+
733+
// Then
734+
XCTAssertEqual(actionButtons, [.publish, .more])
735+
}
719736
}
720737

721738
private extension ProductFormViewModelTests {

0 commit comments

Comments
 (0)