Skip to content

Commit

Permalink
fix: update fetchEmojiList test using sortByDate field
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisWooyeol committed Dec 6, 2023
1 parent 6391ae5 commit a31d78a
Showing 1 changed file with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,23 @@ class EmojiViewModelTest {
coVerify(exactly = 1) { emojiUseCase.updateEmojiList(any()) }
}

// @Test
// fun toggleSortingMode_success_updateTrendingEmojiList() = runTest {
// // given
// // for simplicity of testing, we return the same list for both cases
// val sampleFetchedEmojiList = createDeterministicTrendingEmojiList(10)
// coEvery {
// emojiUseCase.fetchEmojiList(1)
// } returns sampleFetchedEmojiList
// // when
// emojiViewModel.toggleSortingMode()
// advanceUntilIdle()
// // then
// coVerify(exactly = 1) { emojiUseCase.fetchEmojiList(1) }
// coVerify(exactly = 1) { emojiUseCase.updateEmojiList(any()) }
// assertEquals(1, emojiViewModel.sortByDate)
// }
@Test
fun toggleSortingMode_success_updateLatestEmojiList() = runTest {
// given
// for simplicity of testing, we return the same list for both cases
val sampleFetchedEmojiList = createDeterministicTrendingEmojiList(10)
coEvery {
emojiUseCase.fetchEmojiList(1)
} returns sampleFetchedEmojiList
// when
emojiViewModel.sortByDate = 1
emojiViewModel.fetchEmojiList()
advanceUntilIdle()
// then
assertEquals(1, emojiViewModel.sortByDate)
coVerify(exactly = 1) { emojiUseCase.fetchEmojiList(1) }
coVerify(exactly = 1) { emojiUseCase.updateEmojiList(any()) }
}

@Test
fun fetchMyCreatedEmojiList_success_updateMyCreatedEmojiList() = runTest {
Expand Down

0 comments on commit a31d78a

Please sign in to comment.