mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 03:11:10 +01:00
Add unit test for RegistrationUtil.
This commit is contained in:
committed by
Greyson Parrelli
parent
34eef0bf5c
commit
7d24bff134
@@ -1,29 +1,27 @@
|
||||
package org.thoughtcrime.securesms.components.emoji
|
||||
|
||||
import android.app.Application
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import io.mockk.every
|
||||
import io.mockk.mockkObject
|
||||
import org.junit.Assert
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.ParameterizedRobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.dependencies.MockApplicationDependencyProvider
|
||||
import org.thoughtcrime.securesms.emoji.EmojiSource
|
||||
import org.thoughtcrime.securesms.testutil.MockAppDependenciesRule
|
||||
|
||||
@RunWith(ParameterizedRobolectricTestRunner::class)
|
||||
@Config(manifest = Config.NONE, application = Application::class)
|
||||
class EmojiUtilTest_isEmoji(private val input: String?, private val output: Boolean) {
|
||||
|
||||
@get:Rule
|
||||
val appDependencies = MockAppDependenciesRule()
|
||||
|
||||
@Throws(Exception::class)
|
||||
@Test
|
||||
fun isEmoji() {
|
||||
if (!AppDependencies.isInitialized) {
|
||||
AppDependencies.init(ApplicationProvider.getApplicationContext(), MockApplicationDependencyProvider())
|
||||
}
|
||||
|
||||
val source = EmojiSource.loadAssetBasedEmojis()
|
||||
|
||||
mockkObject(EmojiSource) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.thoughtcrime.securesms.components.settings.app.account.export
|
||||
|
||||
import android.app.Application
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import com.fasterxml.jackson.core.JsonParseException
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
@@ -12,14 +11,13 @@ import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertThrows
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.dependencies.MockApplicationDependencyProvider
|
||||
import org.thoughtcrime.securesms.providers.BlobProvider
|
||||
import org.thoughtcrime.securesms.testutil.MockAppDependenciesRule
|
||||
import org.thoughtcrime.securesms.util.JsonUtils
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager
|
||||
import java.io.IOException
|
||||
@@ -28,6 +26,9 @@ import java.io.IOException
|
||||
@Config(manifest = Config.NONE, application = Application::class)
|
||||
class ExportAccountDataTest {
|
||||
|
||||
@get:Rule
|
||||
val appDependencies = MockAppDependenciesRule()
|
||||
|
||||
private val mockJson: String = """
|
||||
{
|
||||
"reportId": "4c0ca2aa-151b-4e9e-8bf4-ea2c64345a22",
|
||||
@@ -64,13 +65,6 @@ class ExportAccountDataTest {
|
||||
}
|
||||
"""
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
if (!AppDependencies.isInitialized) {
|
||||
AppDependencies.init(ApplicationProvider.getApplicationContext(), MockApplicationDependencyProvider())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Export json without text field`() {
|
||||
val scheduler = TestScheduler()
|
||||
|
||||
Reference in New Issue
Block a user