From 5c4400975450c9739f0986561075983e08afae89 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 5 Mar 2019 20:03:55 -0500 Subject: Add fb tab test --- .../com/pitchedapps/frost/db/FbTabsDbTest.kt | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/src/androidTest/kotlin/com/pitchedapps/frost/db/FbTabsDbTest.kt (limited to 'app/src/androidTest') diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FbTabsDbTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FbTabsDbTest.kt new file mode 100644 index 00000000..a2dce692 --- /dev/null +++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/FbTabsDbTest.kt @@ -0,0 +1,32 @@ +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() { + + /** + * 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 { + db.tabDao().save(tabs) + assertEquals(tabs, db.tabDao().selectAll(), "Tab saving failed") + val newTabs = listOf(FbItem.PAGES, FbItem.MENU) + db.tabDao().save(newTabs) + assertEquals(newTabs, db.tabDao().selectAll(), "Tab saving does not delete preexisting items") + } + } + + @Test + fun defaultRetrieve() { + runBlocking { + assertEquals(defaultTabs(), db.tabDao().selectAll(), "Default retrieval failed") + } + } +} \ No newline at end of file -- cgit v1.2.3