Add @After to guarantee DB was closed. (#1240)

* Add @After to guarantee DB was closed.

Change-Id: Ic29b7d12125853c71ddaef1a997ec123bb2dfc8b

* Fix spotless

- style

Co-authored-by: Simon Marquis <contact@simon-marquis.fr>

---------

Co-authored-by: Simon Marquis <contact@simon-marquis.fr>
pull/1259/head
Jaehwa Noh 9 months ago committed by GitHub
parent ab90334210
commit abe798056e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -27,6 +27,7 @@ import com.google.samples.apps.nowinandroid.core.database.model.asExternalModel
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Instant import kotlinx.datetime.Instant
import org.junit.After
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
@ -48,6 +49,9 @@ class NewsResourceDaoTest {
topicDao = db.topicDao() topicDao = db.topicDao()
} }
@After
fun closeDb() = db.close()
@Test @Test
fun newsResourceDao_fetches_items_by_descending_publish_date() = runTest { fun newsResourceDao_fetches_items_by_descending_publish_date() = runTest {
val newsResourceEntities = listOf( val newsResourceEntities = listOf(

Loading…
Cancel
Save