File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
WooCommerce/src/test/kotlin/com/woocommerce/android/ui/products/details Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1404,6 +1404,32 @@ class ProductDetailViewModelTest : BaseUnitTest() {
1404
1404
Assertions .assertThat(menuButtonsState.viewProductOption).isFalse()
1405
1405
}
1406
1406
1407
+ @Test
1408
+ fun `given we can authenticate the user in WebView, when tapping on view product, then show authenticated webview` () =
1409
+ testBlocking {
1410
+ given(canAutoAuthenticateInWebView.invoke(any())).willReturn(true )
1411
+ given(productRepository.getProductAggregate(any())).willReturn(productAggregate)
1412
+
1413
+ viewModel.start()
1414
+ viewModel.onViewProductOnStoreLinkClicked()
1415
+
1416
+ Assertions .assertThat(viewModel.event.value)
1417
+ .isEqualTo(MultiLiveEvent .Event .LaunchUrlInAuthenticatedWebView (productAggregate.product.permalink))
1418
+ }
1419
+
1420
+ @Test
1421
+ fun `given we can't authenticate the user in WebView, when tapping on view product, then show Chrome Custom Tab` () =
1422
+ testBlocking {
1423
+ given(canAutoAuthenticateInWebView.invoke(any())).willReturn(false )
1424
+ given(productRepository.getProductAggregate(any())).willReturn(productAggregate)
1425
+
1426
+ viewModel.start()
1427
+ viewModel.onViewProductOnStoreLinkClicked()
1428
+
1429
+ Assertions .assertThat(viewModel.event.value)
1430
+ .isEqualTo(MultiLiveEvent .Event .LaunchUrlInChromeTab (productAggregate.product.permalink))
1431
+ }
1432
+
1407
1433
private val productsDraft
1408
1434
get() = viewModel.productDetailViewStateData.liveData.value?.productDraft
1409
1435
}
You can’t perform that action at this time.
0 commit comments