aboutsummaryrefslogtreecommitdiff
path: root/app/src/androidTest
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-03-07 17:28:32 -0500
committerAllan Wang <me@allanwang.ca>2019-03-07 17:28:32 -0500
commite617c95e2b4acfcfbeb1a72a658f19e69eaa3d6c (patch)
tree8a8171b7ab6f743051af7fd71bcd8ba538a486b8 /app/src/androidTest
parent9e201159fd6697d83a16b7f7cfc5e7e302d55152 (diff)
downloadfrost-e617c95e2b4acfcfbeb1a72a658f19e69eaa3d6c.tar.gz
frost-e617c95e2b4acfcfbeb1a72a658f19e69eaa3d6c.tar.bz2
frost-e617c95e2b4acfcfbeb1a72a658f19e69eaa3d6c.zip
Rename some methods
Diffstat (limited to 'app/src/androidTest')
-rw-r--r--app/src/androidTest/kotlin/com/pitchedapps/frost/db/CacheDbTest.kt2
-rw-r--r--app/src/androidTest/kotlin/com/pitchedapps/frost/db/CookieDbTest.kt12
-rw-r--r--app/src/androidTest/kotlin/com/pitchedapps/frost/db/NotificationDbTest.kt14
3 files changed, 14 insertions, 14 deletions
diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/CacheDbTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/CacheDbTest.kt
index 780bbd3e..1fe7bbc4 100644
--- a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/CacheDbTest.kt
+++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/CacheDbTest.kt
@@ -19,7 +19,7 @@ class CacheDbTest : BaseDbTest() {
val type = "test"
val content = "long test".repeat(10000)
runBlocking {
- cookieDao.insertCookie(cookie)
+ cookieDao.save(cookie)
dao.save(cookie.id, type, content)
val cache = dao.select(cookie.id, type) ?: fail("Cache not found")
assertEquals(content, cache.contents, "Content mismatch")
diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/CookieDbTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/CookieDbTest.kt
index 5ec771f5..122e3205 100644
--- a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/CookieDbTest.kt
+++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/CookieDbTest.kt
@@ -13,7 +13,7 @@ class CookieDbTest : BaseDbTest() {
fun basicCookie() {
val cookie = CookieEntity(id = 1234L, name = "testName", cookie = "testCookie")
runBlocking {
- dao.insertCookie(cookie)
+ dao.save(cookie)
val cookies = dao.selectAll()
assertEquals(listOf(cookie), cookies, "Cookie mismatch")
}
@@ -24,7 +24,7 @@ class CookieDbTest : BaseDbTest() {
val cookie = CookieEntity(id = 1234L, name = "testName", cookie = "testCookie")
runBlocking {
- dao.insertCookie(cookie)
+ dao.save(cookie)
dao.deleteById(cookie.id + 1)
assertEquals(
listOf(cookie),
@@ -40,15 +40,15 @@ class CookieDbTest : BaseDbTest() {
fun insertReplaceCookie() {
val cookie = CookieEntity(id = 1234L, name = "testName", cookie = "testCookie")
runBlocking {
- dao.insertCookie(cookie)
+ dao.save(cookie)
assertEquals(listOf(cookie), dao.selectAll(), "Cookie insertion failed")
- dao.insertCookie(cookie.copy(name = "testName2"))
+ dao.save(cookie.copy(name = "testName2"))
assertEquals(
listOf(cookie.copy(name = "testName2")),
dao.selectAll(),
"Cookie replacement failed"
)
- dao.insertCookie(cookie.copy(id = 123L))
+ dao.save(cookie.copy(id = 123L))
assertEquals(
setOf(cookie.copy(id = 123L), cookie.copy(name = "testName2")),
dao.selectAll().toSet(),
@@ -61,7 +61,7 @@ class CookieDbTest : BaseDbTest() {
fun selectCookie() {
val cookie = CookieEntity(id = 1234L, name = "testName", cookie = "testCookie")
runBlocking {
- dao.insertCookie(cookie)
+ dao.save(cookie)
assertEquals(cookie, dao.selectById(cookie.id), "Cookie selection failed")
assertNull(dao.selectById(cookie.id + 1), "Inexistent cookie selection failed")
}
diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/NotificationDbTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/NotificationDbTest.kt
index 176d0d3a..25c29db4 100644
--- a/app/src/androidTest/kotlin/com/pitchedapps/frost/db/NotificationDbTest.kt
+++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/db/NotificationDbTest.kt
@@ -31,7 +31,7 @@ class NotificationDbTest : BaseDbTest() {
// Unique unsorted ids
val notifs = listOf(0L, 4L, 2L, 6L, 99L, 3L).map { notifContent(it, cookie) }
runBlocking {
- db.cookieDao().insertCookie(cookie)
+ db.cookieDao().save(cookie)
dao.saveNotifications(NOTIF_CHANNEL_GENERAL, notifs)
val dbNotifs = dao.selectNotifications(cookie.id, NOTIF_CHANNEL_GENERAL)
assertEquals(notifs.sortedByDescending { it.timestamp }, dbNotifs, "Incorrect notification list received")
@@ -45,8 +45,8 @@ class NotificationDbTest : BaseDbTest() {
val cookie2 = cookie(12L)
val notifs1 = (0L..2L).map { notifContent(it, cookie1) }
val notifs2 = (5L..10L).map { notifContent(it, cookie2) }
- db.cookieDao().insertCookie(cookie1)
- db.cookieDao().insertCookie(cookie2)
+ db.cookieDao().save(cookie1)
+ db.cookieDao().save(cookie2)
dao.saveNotifications(NOTIF_CHANNEL_GENERAL, notifs1)
dao.saveNotifications(NOTIF_CHANNEL_MESSAGES, notifs2)
assertEquals(
@@ -82,8 +82,8 @@ class NotificationDbTest : BaseDbTest() {
val cookie2 = cookie(12L)
val notifs1 = (0L..2L).map { notifContent(it, cookie1) }
val notifs2 = notifs1.map { it.copy(data = cookie2) }
- db.cookieDao().insertCookie(cookie1)
- db.cookieDao().insertCookie(cookie2)
+ db.cookieDao().save(cookie1)
+ db.cookieDao().save(cookie2)
assertTrue(dao.saveNotifications(NOTIF_CHANNEL_GENERAL, notifs1), "Notif1 save failed")
assertTrue(dao.saveNotifications(NOTIF_CHANNEL_GENERAL, notifs2), "Notif2 save failed")
}
@@ -95,7 +95,7 @@ class NotificationDbTest : BaseDbTest() {
// Unique unsorted ids
val notifs = listOf(0L, 4L, 2L, 6L, 99L, 3L).map { notifContent(it, cookie) }
runBlocking {
- db.cookieDao().insertCookie(cookie)
+ db.cookieDao().save(cookie)
dao.saveNotifications(NOTIF_CHANNEL_GENERAL, notifs)
db.cookieDao().deleteById(cookie.id)
val dbNotifs = dao.selectNotifications(cookie.id, NOTIF_CHANNEL_GENERAL)
@@ -110,7 +110,7 @@ class NotificationDbTest : BaseDbTest() {
val notifs = listOf(0L, 4L, 2L, 6L, 99L, 3L).map { notifContent(it, cookie) }
runBlocking {
assertEquals(-1L, dao.latestEpoch(cookie.id, NOTIF_CHANNEL_GENERAL), "Default epoch failed")
- db.cookieDao().insertCookie(cookie)
+ db.cookieDao().save(cookie)
dao.saveNotifications(NOTIF_CHANNEL_GENERAL, notifs)
assertEquals(99L, dao.latestEpoch(cookie.id, NOTIF_CHANNEL_GENERAL), "Latest epoch failed")
}