Skip to content

Commit

Permalink
chore: [#274] initial setup test using JUnit & MockK
Browse files Browse the repository at this point in the history
  • Loading branch information
andhikayuana committed Nov 22, 2024
1 parent 9821c9e commit d95dd48
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ dependencies {

// Get the latest version from https://mvnrepository.com/artifact/com.appsflyer/af-android-sdk
implementation 'com.appsflyer:af-android-sdk:6.15.1'

//test
testImplementation "io.mockk:mockk:1.13.13"
testImplementation 'junit:junit:4.13.2'
}


Expand Down
25 changes: 25 additions & 0 deletions app/src/test/java/com/breadwallet/tools/util/LocaleHelperTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.breadwallet.tools.util

import android.content.Context
import com.breadwallet.entities.Language
import io.mockk.mockk
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test

class LocaleHelperTest {

@Test
fun `given LocaleHelper instance, then should validate default value`() {
val context: Context = mockk(relaxed = true)

LocaleHelper.init(context)

val currentLocale = LocaleHelper.instance.currentLocale

assertTrue(currentLocale == Language.ENGLISH)
assertEquals("en", currentLocale.code)
assertEquals("English", currentLocale.title)
assertEquals("Select language", currentLocale.desc)
}
}

0 comments on commit d95dd48

Please sign in to comment.