aboutsummaryrefslogtreecommitdiff
path: root/app/src/androidTest
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/androidTest')
-rw-r--r--app/src/androidTest/kotlin/com/pitchedapps/frost/db/FbTabsDbTest.kt34
-rw-r--r--app/src/androidTest/kotlin/com/pitchedapps/frost/db/GenericDbTest.kt46
2 files changed, 46 insertions, 34 deletions
diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FbTabsDbTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FbTabsDbTest.kt
deleted file mode 100644
index 752112f9..00000000
--- a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FbTabsDbTest.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.pitchedapps.frost.db
-
-import com.pitchedapps.frost.facebook.FbItem
-import com.pitchedapps.frost.facebook.defaultTabs
-import kotlinx.coroutines.runBlocking
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-class FbTabsDbTest : BaseDbTest() {
-
- private val dao get() = db.tabDao()
-
- /**
- * Note that order is also preserved here
- */
- @Test
- fun save() {
- val tabs = listOf(FbItem.ACTIVITY_LOG, FbItem.BIRTHDAYS, FbItem.EVENTS, FbItem.MARKETPLACE, FbItem.ACTIVITY_LOG)
- runBlocking {
- dao.save(tabs)
- assertEquals(tabs, dao.selectAll(), "Tab saving failed")
- val newTabs = listOf(FbItem.PAGES, FbItem.MENU)
- dao.save(newTabs)
- assertEquals(newTabs, dao.selectAll(), "Tab saving does not delete preexisting items")
- }
- }
-
- @Test
- fun defaultRetrieve() {
- runBlocking {
- assertEquals(defaultTabs(), dao.selectAll(), "Default retrieval failed")
- }
- }
-} \ No newline at end of file
diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/GenericDbTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/GenericDbTest.kt
new file mode 100644
index 00000000..9979eca4
--- /dev/null
+++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/GenericDbTest.kt
@@ -0,0 +1,46 @@
+package com.pitchedapps.frost.db
+
+import com.pitchedapps.frost.facebook.FbItem
+import com.pitchedapps.frost.facebook.defaultTabs
+import kotlinx.coroutines.runBlocking
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+class GenericDbTest : BaseDbTest() {
+
+ private val dao get() = db.genericDao()
+
+ /**
+ * Note that order is also preserved here
+ */
+ @Test
+ fun save() {
+ val tabs = listOf(FbItem.ACTIVITY_LOG, FbItem.BIRTHDAYS, FbItem.EVENTS, FbItem.MARKETPLACE, FbItem.ACTIVITY_LOG)
+ runBlocking {
+ dao.saveTabs(tabs)
+ assertEquals(tabs, dao.getTabs(), "Tab saving failed")
+ val newTabs = listOf(FbItem.PAGES, FbItem.MENU)
+ dao.saveTabs(newTabs)
+ assertEquals(newTabs, dao.getTabs(), "Tab overwrite failed")
+ }
+ }
+
+ @Test
+ fun defaultRetrieve() {
+ runBlocking {
+ assertEquals(defaultTabs(), dao.getTabs(), "Default retrieval failed")
+ }
+ }
+
+ @Test
+ fun ignoreErrors() {
+ runBlocking {
+ dao.save(GenericEntity(GenericDao.TYPE_TABS, "${FbItem.ACTIVITY_LOG.name},unknown,${FbItem.EVENTS.name}"))
+ assertEquals(
+ listOf(FbItem.ACTIVITY_LOG, FbItem.EVENTS),
+ dao.getTabs(),
+ "Tab fetching does not ignore unknown names"
+ )
+ }
+ }
+} \ No newline at end of file