mirror of https://github.com/readrops/Readrops.git
Fix tests
This commit is contained in:
parent
c2110b08c9
commit
63a8891880
|
@ -25,9 +25,9 @@ class RSS1ItemsAdapterTest {
|
|||
|
||||
assertEquals(items.size, 4)
|
||||
assertEquals(item.title, "Google Expands its Flutter Development Kit To Windows Apps")
|
||||
assertEquals(item.link.trim(), "https://developers.slashdot.org/story/20/09/23/1616231/google-expands-" +
|
||||
assertEquals(item.link!!.trim(), "https://developers.slashdot.org/story/20/09/23/1616231/google-expands-" +
|
||||
"its-flutter-development-kit-to-windows-apps?utm_source=rss1.0mainlinkanon&utm_medium=feed")
|
||||
assertEquals(item.guid.trim(), "https://developers.slashdot.org/story/20/09/23/1616231/google-expands-" +
|
||||
assertEquals(item.guid!!.trim(), "https://developers.slashdot.org/story/20/09/23/1616231/google-expands-" +
|
||||
"its-flutter-development-kit-to-windows-apps?utm_source=rss1.0mainlinkanon&utm_medium=feed")
|
||||
assertEquals(item.pubDate, DateUtils.parse("2020-09-23T16:15:00+00:00"))
|
||||
assertEquals(item.author, "msmash")
|
||||
|
|
|
@ -25,11 +25,11 @@ class OPMLParserTest {
|
|||
|
||||
assertEquals(foldersAndFeeds?.size, 6)
|
||||
|
||||
assertEquals(foldersAndFeeds?.get(Folder("Folder 1"))?.size, 2)
|
||||
assertEquals(foldersAndFeeds?.get(Folder("Subfolder 1"))?.size, 4)
|
||||
assertEquals(foldersAndFeeds?.get(Folder("Subfolder 2"))?.size, 1)
|
||||
assertEquals(foldersAndFeeds?.get(Folder("Sub subfolder 1"))?.size, 2)
|
||||
assertEquals(foldersAndFeeds?.get(Folder("Sub subfolder 2"))?.size, 0)
|
||||
assertEquals(foldersAndFeeds?.get(Folder(name = "Folder 1"))?.size, 2)
|
||||
assertEquals(foldersAndFeeds?.get(Folder(name = "Subfolder 1"))?.size, 4)
|
||||
assertEquals(foldersAndFeeds?.get(Folder(name = "Subfolder 2"))?.size, 1)
|
||||
assertEquals(foldersAndFeeds?.get(Folder(name = "Sub subfolder 1"))?.size, 2)
|
||||
assertEquals(foldersAndFeeds?.get(Folder(name = "Sub subfolder 2"))?.size, 0)
|
||||
assertEquals(foldersAndFeeds?.get(null)?.size, 2)
|
||||
|
||||
stream.close()
|
||||
|
@ -68,11 +68,11 @@ class OPMLParserTest {
|
|||
val outputStream = FileOutputStream(file)
|
||||
|
||||
val foldersAndFeeds: Map<Folder?, List<Feed>> = HashMap<Folder?, List<Feed>>().apply {
|
||||
put(null, listOf(Feed("Feed1", "", "https://feed1.com"),
|
||||
Feed("Feed2", "", "https://feed2.com")))
|
||||
put(Folder("Folder1"), listOf())
|
||||
put(Folder("Folder2"), listOf(Feed("Feed3", "", "https://feed3.com"),
|
||||
Feed("Feed4", "", "https://feed4.com")))
|
||||
put(null, listOf(Feed(name = "Feed1", url = "https://feed1.com"),
|
||||
Feed(name = "Feed2", url = "https://feed2.com")))
|
||||
put(Folder(name = "Folder1"), listOf())
|
||||
put(Folder(name = "Folder2"), listOf(Feed(name = "Feed3", url = "https://feed3.com"),
|
||||
Feed(name = "Feed4", url ="https://feed4.com")))
|
||||
}
|
||||
|
||||
OPMLParser.write(foldersAndFeeds, outputStream)
|
||||
|
@ -87,8 +87,8 @@ class OPMLParserTest {
|
|||
OPMLParser.read(inputStream).subscribe { result -> foldersAndFeeds2 = result }
|
||||
|
||||
assertEquals(foldersAndFeeds.size, foldersAndFeeds2?.size)
|
||||
assertEquals(foldersAndFeeds[Folder("Folder1")]?.size, foldersAndFeeds2?.get(Folder("Folder1"))?.size)
|
||||
assertEquals(foldersAndFeeds[Folder("Folder2")]?.size, foldersAndFeeds2?.get(Folder("Folder2"))?.size)
|
||||
assertEquals(foldersAndFeeds[Folder(name = "Folder1")]?.size, foldersAndFeeds2?.get(Folder(name = "Folder1"))?.size)
|
||||
assertEquals(foldersAndFeeds[Folder(name = "Folder2")]?.size, foldersAndFeeds2?.get(Folder(name = "Folder2"))?.size)
|
||||
assertEquals(foldersAndFeeds[null]?.size, foldersAndFeeds2?.get(null)?.size)
|
||||
|
||||
inputStream.close()
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.readrops.db.dao
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
import androidx.room.RoomWarnings
|
||||
import androidx.room.Transaction
|
||||
import com.readrops.db.entities.Feed
|
||||
import com.readrops.db.entities.account.Account
|
||||
|
@ -57,11 +58,13 @@ abstract class FeedDao : BaseDao<Feed> {
|
|||
@Query("Update Feed set text_color = :textColor, background_color = :bgColor Where id = :feedId")
|
||||
abstract fun updateColors(feedId: Int, textColor: Int, bgColor: Int)
|
||||
|
||||
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
|
||||
@Query("Select Feed.name as feed_name, Feed.id as feed_id, Folder.name as folder_name, Folder.id as folder_id, Folder.remoteId as folder_remoteId, Folder.account_id as folder_account_id," +
|
||||
"Feed.description as feed_description, Feed.icon_url as feed_icon_url, Feed.url as feed_url, Feed.folder_id as feed_folder_id, Feed.text_color as feed_text_color, Feed.background_color as feed_background_color" +
|
||||
", Feed.account_id as feed_account_id, Feed.notification_enabled as feed_notification_enabled, Feed.siteUrl as feed_siteUrl, Feed.remoteId as feed_remoteId from Feed Left Join Folder on Feed.folder_id = Folder.id Where Feed.account_id = :accountId Order by Feed.name")
|
||||
abstract fun getAllFeedsWithFolder(accountId: Int): LiveData<List<FeedWithFolder>>
|
||||
|
||||
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
|
||||
@Query("Select id, name, icon_url, notification_enabled, text_color, background_color, account_id From Feed Where account_id = :accountId")
|
||||
abstract fun getFeedsForNotifPermission(accountId: Int): LiveData<List<Feed>>
|
||||
|
||||
|
|
Loading…
Reference in New Issue