Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
svenjacobs committed Jun 10, 2024
1 parent 9e28f76 commit 31cca9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class RepositoryTest : DIAware {
every { settingsStore.syncOnlyOnWifi } returns MutableStateFlow(false)
every { settingsStore.addedFeederNews } returns MutableStateFlow(true)
every { settingsStore.minReadTime } returns MutableStateFlow(Instant.EPOCH)

every { feedItemStore.getFeedItemCountRaw(any(), any(), any(), any()) } returns flowOf(0)
}

@Test
Expand Down Expand Up @@ -286,7 +288,7 @@ class RepositoryTest : DIAware {
repository.getScreenTitleForFeedOrTag(ID_ALL_FEEDS, "").toList().first()
}

assertEquals(ScreenTitle(title = null, type = FeedType.ALL_FEEDS), result)
assertEquals(ScreenTitle(title = null, type = FeedType.ALL_FEEDS, unreadCount = 0), result)
}

@Test
Expand All @@ -296,7 +298,7 @@ class RepositoryTest : DIAware {
repository.getScreenTitleForFeedOrTag(ID_SAVED_ARTICLES, "").toList().first()
}

assertEquals(ScreenTitle(title = null, type = FeedType.SAVED_ARTICLES), result)
assertEquals(ScreenTitle(title = null, type = FeedType.SAVED_ARTICLES, unreadCount = 0), result)
}

@Test
Expand All @@ -306,7 +308,7 @@ class RepositoryTest : DIAware {
repository.getScreenTitleForFeedOrTag(ID_UNSET, "fwr").toList().first()
}

assertEquals(ScreenTitle(title = "fwr", type = FeedType.TAG), result)
assertEquals(ScreenTitle(title = "fwr", type = FeedType.TAG, unreadCount = 0), result)
}

@Test
Expand All @@ -318,7 +320,7 @@ class RepositoryTest : DIAware {
repository.getScreenTitleForFeedOrTag(5L, "fwr").toList().first()
}

assertEquals(ScreenTitle(title = "floppa", type = FeedType.FEED), result)
assertEquals(ScreenTitle(title = "floppa", type = FeedType.FEED, unreadCount = 0), result)

coVerify {
feedStore.getDisplayTitle(5L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,15 @@ class SettingsStoreTest : DIAware {
val allSettings = store.getAllSettings()
assertEquals(1, allSettings.size)
}

@Test
fun showTitleUnreadCount() {
store.setShowTitleUnreadCount(true)

verify {
sp.edit().putBoolean(PREF_SHOW_TITLE_UNREAD_COUNT, true).apply()
}

assertEquals(true, store.showTitleUnreadCount.value)
}
}

0 comments on commit 31cca9c

Please sign in to comment.