test: close DB in TimelineDaoTest (#512)

The previous code forgot to close the DB after TimelineDaoTest was run,
so a warning message was displayed when the test was run locally.

Close the database using the `@After` annotation.

Fixes #511
This commit is contained in:
sanao 2024-03-08 19:40:51 +09:00 committed by GitHub
parent 21b85fce1b
commit 0105a8179c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest import dagger.hilt.android.testing.HiltAndroidTest
import javax.inject.Inject import javax.inject.Inject
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.junit.After
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Before import org.junit.Before
import org.junit.Rule import org.junit.Rule
@ -51,6 +52,11 @@ class TimelineDaoTest {
hilt.inject() hilt.inject()
} }
@After
fun tearDown() {
db.close()
}
@Test @Test
fun insertGetStatus() = runBlocking { fun insertGetStatus() = runBlocking {
val setOne = makeStatus(statusId = 3) val setOne = makeStatus(statusId = 3)