mirror of
https://github.com/bitwarden/android.git
synced 2024-11-24 02:15:53 +03:00
Cosmetic test fixes (#24)
This commit is contained in:
parent
915e9d5fd6
commit
6f524318b7
7 changed files with 4 additions and 57 deletions
|
@ -1,32 +0,0 @@
|
|||
package com.x8bit.bitwarden.example
|
||||
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.ui.test.onRoot
|
||||
import androidx.compose.ui.test.performClick
|
||||
import com.x8bit.bitwarden.example.ui.BaseComposeTest
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Example showing that Compose tests using "junit" imports and Robolectric work.
|
||||
*/
|
||||
class ExampleComposeTest : BaseComposeTest() {
|
||||
@Test
|
||||
fun `the onClick callback should be correctly triggered when performing a click`() {
|
||||
var isClicked = false
|
||||
composeTestRule.setContent {
|
||||
Button(
|
||||
onClick = { isClicked = true },
|
||||
) {
|
||||
// Empty
|
||||
}
|
||||
}
|
||||
|
||||
assertFalse(isClicked)
|
||||
|
||||
composeTestRule.onRoot().performClick()
|
||||
|
||||
assertTrue(isClicked)
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package com.x8bit.bitwarden.example
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Nested
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
/**
|
||||
* Example showing that JUnit5 tests using "jupiter" imports work.
|
||||
*/
|
||||
class ExampleJUnit5Test {
|
||||
@Nested
|
||||
inner class NestedSample {
|
||||
@Test
|
||||
fun `an empty listOf should be the same as emptyList`() {
|
||||
assertEquals(listOf<Any>(), emptyList<Any>())
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import retrofit2.Retrofit
|
|||
import retrofit2.create
|
||||
import retrofit2.http.GET
|
||||
|
||||
class ResultCallAdapterTests {
|
||||
class ResultCallAdapterTest {
|
||||
|
||||
private val server: MockWebServer = MockWebServer().apply { start() }
|
||||
private val testService: FakeService =
|
|
@ -15,7 +15,7 @@ import org.junit.Test
|
|||
class CreateAccountScreenTest : BaseComposeTest() {
|
||||
|
||||
@Test
|
||||
fun `on submit click should send SubmitClick action`() {
|
||||
fun `submit click should send SubmitClick action`() {
|
||||
val viewModel = mockk<CreateAccountViewModel>(relaxed = true) {
|
||||
every { eventFlow } returns emptyFlow()
|
||||
every { trySendAction(CreateAccountAction.SubmitClick) } returns Unit
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test
|
|||
class CreateAccountViewModelTest : BaseViewModelTest() {
|
||||
|
||||
@Test
|
||||
fun `on SubmitClick should emit ShowToast`() = runTest {
|
||||
fun `SubmitClick should emit ShowToast`() = runTest {
|
||||
val viewModel = CreateAccountViewModel()
|
||||
viewModel.eventFlow.test {
|
||||
viewModel.actionChannel.trySend(CreateAccountAction.SubmitClick)
|
||||
|
|
|
@ -14,9 +14,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||
import kotlinx.coroutines.flow.emptyFlow
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Example showing that Compose tests using "junit" imports and Robolectric work.
|
||||
*/
|
||||
class LandingScreenTest : BaseComposeTest() {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.x8bit.bitwarden.ui.feature.rootnav.RootNavViewModel
|
|||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class RootNavViewModelTests : BaseViewModelTest() {
|
||||
class RootNavViewModelTest : BaseViewModelTest() {
|
||||
|
||||
@Test
|
||||
fun `initial state should be splash`() {
|
Loading…
Reference in a new issue