@@ -67,10 +67,9 @@ class RemotePreviewLogicHelperTest {
6767 }
6868
6969 @Test
70- fun `preview not available for self hosted sites not using WPComRestApi on published post with modifications` () {
70+ fun `preview not available for self hosted sites not using WPComRestApi on a post with modifications` () {
7171 // Given
7272 doReturn(false ).whenever(site).isUsingWpComRestApi
73- doReturn(PostStatus .PUBLISHED .toString()).whenever(post).status
7473 doReturn(true ).whenever(post).isLocallyChanged
7574
7675 // When
@@ -86,7 +85,7 @@ class RemotePreviewLogicHelperTest {
8685 }
8786
8887 @Test
89- fun `preview available for self hosted sites not using WPComRestApi on drafts ` () {
88+ fun `preview not available for self hosted sites not using WPComRestApi` () {
9089 // Given
9190 // next stub not used (made lenient) in case we update future logic.
9291 lenient().doReturn(false ).whenever(site).isUsingWpComRestApi
@@ -95,8 +94,12 @@ class RemotePreviewLogicHelperTest {
9594 val result = remotePreviewLogicHelper.runPostPreviewLogic(activity, site, post, helperFunctions)
9695
9796 // Then
98- assertThat(result).isEqualTo(RemotePreviewLogicHelper .PreviewLogicOperationResult .GENERATING_PREVIEW )
99- verify(helperFunctions, times(1 )).startUploading(false , post)
97+ assertThat(result).isEqualTo(RemotePreviewLogicHelper .PreviewLogicOperationResult .PREVIEW_NOT_AVAILABLE )
98+ verify(activityLauncherWrapper, times(1 )).showActionableEmptyView(
99+ activity,
100+ WPWebViewUsageCategory .REMOTE_PREVIEW_NOT_AVAILABLE ,
101+ post.title
102+ )
100103 }
101104
102105 @Test
@@ -232,7 +235,6 @@ class RemotePreviewLogicHelperTest {
232235 fun `preview not available for Jetpack sites on published post with modification` () {
233236 // Given
234237 doReturn(true ).whenever(site).isJetpackConnected
235- doReturn(PostStatus .PUBLISHED .toString()).whenever(post).status
236238 doReturn(true ).whenever(post).isLocallyChanged
237239
238240 // When
@@ -247,8 +249,12 @@ class RemotePreviewLogicHelperTest {
247249 )
248250 }
249251
252+ /* *
253+ * Preview for Jetpack sites is temporarily disabled due to a server side bug.
254+ * https://github.com/Automattic/wp-calypso/issues/20265
255+ */
250256 @Test
251- fun `preview available for Jetpack sites on draft with modification` () {
257+ fun `preview not available for Jetpack sites on a post with modification` () {
252258 // Given
253259 // next stub not used (made lenient) in case we update future logic.
254260 lenient().doReturn(true ).whenever(site).isJetpackConnected
@@ -258,16 +264,19 @@ class RemotePreviewLogicHelperTest {
258264 val result = remotePreviewLogicHelper.runPostPreviewLogic(activity, site, post, helperFunctions)
259265
260266 // Then
261- assertThat(result).isEqualTo(RemotePreviewLogicHelper .PreviewLogicOperationResult .GENERATING_PREVIEW )
262- verify(helperFunctions, times(1 )).startUploading(false , post)
267+ assertThat(result).isEqualTo(RemotePreviewLogicHelper .PreviewLogicOperationResult .PREVIEW_NOT_AVAILABLE )
268+ verify(activityLauncherWrapper, times(1 )).showActionableEmptyView(
269+ activity,
270+ WPWebViewUsageCategory .REMOTE_PREVIEW_NOT_AVAILABLE ,
271+ post.title
272+ )
263273 }
264274
265275 @Test
266- fun `preview available for Jetpack sites on published post without modification` () {
276+ fun `preview available for Jetpack sites on a post post without modification` () {
267277 // Given
268278 // next stub not used (made lenient) in case we update future logic
269279 lenient().doReturn(true ).whenever(site).isJetpackConnected
270- doReturn(PostStatus .PUBLISHED .toString()).whenever(post).status
271280 doReturn(false ).whenever(post).isLocallyChanged
272281
273282 // When
@@ -279,7 +288,7 @@ class RemotePreviewLogicHelperTest {
279288 }
280289
281290 @Test
282- fun `preview available for Jetpack sites on draft without modification` () {
291+ fun `preview available for Jetpack sites on a post without modification` () {
283292 // Given
284293 lenient().doReturn(true ).whenever(site).isJetpackConnected
285294 doReturn(false ).whenever(post).isLocallyChanged
0 commit comments