Replace Kotlin assertions with JUnit assertions. (#168)

This commit is contained in:
David Perez 2023-10-26 16:57:59 -05:00 committed by Álison Fernandes
parent ba5eac69ac
commit d0e0362771
4 changed files with 11 additions and 6 deletions

View file

@ -10,6 +10,7 @@ import kotlinx.coroutines.test.runTest
import kotlinx.serialization.json.Json
import okhttp3.mockwebserver.MockResponse
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import retrofit2.create
@ -33,7 +34,7 @@ class AccountsServiceTest : BaseServiceTest() {
"""
val response = MockResponse().setBody(json)
server.enqueue(response)
assert(service.preLogin(EMAIL).isFailure)
assertTrue(service.preLogin(EMAIL).isFailure)
}
@Test
@ -47,7 +48,7 @@ class AccountsServiceTest : BaseServiceTest() {
"""
val response = MockResponse().setBody(json)
server.enqueue(response)
assert(service.preLogin(EMAIL).isFailure)
assertTrue(service.preLogin(EMAIL).isFailure)
}
@Test
@ -61,7 +62,7 @@ class AccountsServiceTest : BaseServiceTest() {
"""
val response = MockResponse().setBody(json)
server.enqueue(response)
assert(service.preLogin(EMAIL).isFailure)
assertTrue(service.preLogin(EMAIL).isFailure)
}
@Test
@ -144,6 +145,7 @@ class AccountsServiceTest : BaseServiceTest() {
result.getOrThrow(),
)
}
@Test
fun `register failure with Error json should return Error`() = runTest {
val json = """

View file

@ -30,6 +30,7 @@ import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.update
import org.junit.Test
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
class LandingScreenTest : BaseComposeTest() {
private val resources
@ -196,7 +197,7 @@ class LandingScreenTest : BaseComposeTest() {
viewModel = viewModel,
)
}
assert(onNavigateToCreateAccountCalled)
assertTrue(onNavigateToCreateAccountCalled)
}
@Test

View file

@ -10,6 +10,7 @@ import io.mockk.verify
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.flowOf
import org.junit.Test
import org.junit.jupiter.api.Assertions.assertTrue
class AccountSecurityScreenTest : BaseComposeTest() {
@ -57,6 +58,6 @@ class AccountSecurityScreenTest : BaseComposeTest() {
onNavigateBack = { haveCalledNavigateBack = true },
)
}
assert(haveCalledNavigateBack)
assertTrue(haveCalledNavigateBack)
}
}

View file

@ -9,6 +9,7 @@ import io.mockk.verify
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.flowOf
import org.junit.Test
import org.junit.jupiter.api.Assertions.assertTrue
class SettingsScreenTest : BaseComposeTest() {
@ -124,6 +125,6 @@ class SettingsScreenTest : BaseComposeTest() {
},
)
}
assert(haveCalledNavigateToAccountSecurity)
assertTrue(haveCalledNavigateToAccountSecurity)
}
}