Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Jun 7, 2023
1 parent 36ab3a4 commit 3160cc9
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ package com.facebook.react.modules.share

import android.app.Activity
import android.content.Intent
import androidx.annotation.NonNull
import com.facebook.react.bridge.JavaOnlyMap
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactTestHelper
import com.facebook.react.bridge.WritableMap
import com.facebook.testutils.shadows.ShadowArguments
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Before
Expand All @@ -31,8 +29,8 @@ import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
class ShareModuleTest {

private var activity: Activity? = null
private var shareModule: ShareModule? = null
private lateinit var activity: Activity
private lateinit var shareModule: ShareModule

@Before
fun prepareModules() {
Expand All @@ -43,12 +41,6 @@ class ShareModuleTest {
shareModule = ShareModule(applicationContext)
}

@After
fun cleanUp() {
activity = null
shareModule = null
}

@Test
fun testShareDialog() {
val title = "Title"
Expand All @@ -61,7 +53,7 @@ class ShareModuleTest {

val promise = SimplePromise()

shareModule?.share(content, dialogTitle, promise)
shareModule.share(content, dialogTitle, promise)

val chooserIntent = shadowOf(RuntimeEnvironment.application).nextStartedActivity
assertNotNull("Dialog was not displayed", chooserIntent)
Expand All @@ -83,7 +75,7 @@ class ShareModuleTest {

val promise = SimplePromise()

shareModule?.share(null, dialogTitle, promise)
shareModule.share(null, dialogTitle, promise)

assertEquals(1, promise.rejected)
assertEquals(ShareModule.ERROR_INVALID_CONTENT, promise.errorCode)
Expand Down

0 comments on commit 3160cc9

Please sign in to comment.