test: seed host in ChatViewModelScopeTest Before setup
This commit is contained in:
parent
95a5633e5f
commit
0375eef935
1 changed files with 20 additions and 0 deletions
|
|
@ -6,8 +6,14 @@ import androidx.compose.ui.test.onAllNodesWithText
|
||||||
import androidx.compose.ui.test.onNodeWithText
|
import androidx.compose.ui.test.onNodeWithText
|
||||||
import androidx.compose.ui.test.performClick
|
import androidx.compose.ui.test.performClick
|
||||||
import androidx.compose.ui.test.performTextInput
|
import androidx.compose.ui.test.performTextInput
|
||||||
|
import androidx.test.core.app.ApplicationProvider
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
import app.hermes.mobile.HermesApplication
|
||||||
import app.hermes.mobile.MainActivity
|
import app.hermes.mobile.MainActivity
|
||||||
|
import app.hermes.mobile.core.model.HermesHost
|
||||||
|
import app.hermes.mobile.core.model.HermesHostId
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
|
@ -18,6 +24,20 @@ class ChatViewModelScopeTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val composeTestRule = createAndroidComposeRule<MainActivity>()
|
val composeTestRule = createAndroidComposeRule<MainActivity>()
|
||||||
|
|
||||||
|
@Before
|
||||||
|
fun setup() {
|
||||||
|
val app = ApplicationProvider.getApplicationContext<HermesApplication>()
|
||||||
|
runBlocking {
|
||||||
|
app.container.connectionManager.addHost(
|
||||||
|
HermesHost(
|
||||||
|
id = HermesHostId("test-host-id"),
|
||||||
|
displayName = "Test Host",
|
||||||
|
baseUrl = "http://127.0.0.1:9119"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testChatStateSurvivesRecreation() {
|
fun testChatStateSurvivesRecreation() {
|
||||||
// Wait for New Session button and click
|
// Wait for New Session button and click
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue