aboutsummaryrefslogtreecommitdiff
path: root/app/src/androidTest
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-03-05 18:31:47 -0500
committerAllan Wang <me@allanwang.ca>2019-03-05 18:31:47 -0500
commitc917dc13dabe7781a097383ae89f2d00f32fffcb (patch)
treea5a4edb12b6fc002ee76ef175533feb6cd7b7b75 /app/src/androidTest
parent566fcce5b79cfa22b0828d92e33ac4f109564927 (diff)
downloadfrost-c917dc13dabe7781a097383ae89f2d00f32fffcb.tar.gz
frost-c917dc13dabe7781a097383ae89f2d00f32fffcb.tar.bz2
frost-c917dc13dabe7781a097383ae89f2d00f32fffcb.zip
Create initial room models
Diffstat (limited to 'app/src/androidTest')
-rw-r--r--app/src/androidTest/kotlin/com/pitchedapps/frost/db/FrostDatabaseTest.kt46
1 files changed, 46 insertions, 0 deletions
diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FrostDatabaseTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FrostDatabaseTest.kt
new file mode 100644
index 00000000..6b68e804
--- /dev/null
+++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FrostDatabaseTest.kt
@@ -0,0 +1,46 @@
+package com.pitchedapps.frost.db
+
+import android.content.Context
+import androidx.room.Room
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import kotlin.test.assertEquals
+
+@RunWith(AndroidJUnit4::class)
+class FrostDatabaseTest {
+
+ private lateinit var db: FrostDatabase
+
+ @Before
+ fun before() {
+
+ val context = ApplicationProvider.getApplicationContext<Context>()
+ val privateDb = Room.inMemoryDatabaseBuilder(
+ context, FrostPrivateDatabase::class.java
+ ).build()
+ val publicDb = Room.inMemoryDatabaseBuilder(
+ context, FrostPublicDatabase::class.java
+ ).build()
+ db = FrostDatabase(privateDb, publicDb)
+ }
+
+ @After
+ fun after() {
+ db.close()
+ }
+
+ @Test
+ fun basic() {
+ val cookie = CookieEntity(id = 1234L, name = "testName", cookie = "testCookie")
+ runBlocking {
+ db.cookieDao().insertCookie(cookie)
+ val cookies = db.cookieDao().selectAll()
+ assertEquals(listOf(cookie), cookies, "Cookie mismatch")
+ }
+ }
+} \ No newline at end of file