Skip to content

Commit

Permalink
chore(repository): add test for flags repository (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoberaldin authored May 3, 2023
1 parent f7810d6 commit 603ce18
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .idea/runConfigurations/FlagsRepositoryTest.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core-localization/tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ kotlin {
sourceSets {
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)

implementation(project(":core-localization"))
implementation(kotlin("test-junit5"))
Expand Down
1 change: 1 addition & 0 deletions core-persistence/tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ kotlin {
sourceSets {
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
implementation(libs.kotlinx.coroutines.test)

implementation(project(":core-common"))
Expand Down
1 change: 1 addition & 0 deletions core-repository/tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ kotlin {
sourceSets {
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
implementation(libs.kotlinx.coroutines.test)

implementation(project(":core-common"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package repository

import kotlin.test.Test

class FlagsRepositoryTest {

private val sut = FlagsRepository()

@Test
fun givenRepositoryWhenItLanguageFlagIsQueriedThenCorrectFlagIsReturned() {
val res = sut.getFlag("it")
assert(res == "\uD83C\uDDEE\uD83C\uDDF9")
}

@Test
fun givenRepositoryWhenDeLanguageFlagIsQueriedThenCorrectFlagIsReturned() {
val res = sut.getFlag("de")
assert(res == "\uD83C\uDDE9\uD83C\uDDEA")
}

@Test
fun givenRepositoryWhenFrLanguageFlagIsQueriedThenCorrectFlagIsReturned() {
val res = sut.getFlag("fr")
assert(res == "\uD83C\uDDEB\uD83C\uDDF7")
}

@Test
fun givenRepositoryWhenElLanguageFlagIsQueriedThenCorrectFlagIsReturned() {
val res = sut.getFlag("el")
assert(res == "\uD83C\uDDEC\uD83C\uDDF7")
}

@Test
fun givenRepositoryWhenUnknownLanguageFlagIsQueriedThenDefaultFlagIsReturned() {
val res = sut.getFlag("xx")
assert(res == "\uD83C\uDDEC\uD83C\uDDE7")
}
}

0 comments on commit 603ce18

Please sign in to comment.