Fix story unit test compilation.

fork-5.53.8
Alex Hart 2022-09-20 09:25:44 -03:00 zatwierdzone przez Cody Henthorne
rodzic 8eebdaf451
commit 2566d6f61f
2 zmienionych plików z 15 dodań i 16 usunięć

Wyświetl plik

@ -41,7 +41,7 @@ class StoryViewerViewModelTest {
RxJavaPlugins.setInitComputationSchedulerHandler { testScheduler } RxJavaPlugins.setInitComputationSchedulerHandler { testScheduler }
RxJavaPlugins.setComputationSchedulerHandler { testScheduler } RxJavaPlugins.setComputationSchedulerHandler { testScheduler }
whenever(repository.getFirstStory(any(), any(), any())).doReturn(Single.just(mock())) whenever(repository.getFirstStory(any(), any())).doReturn(Single.just(mock()))
} }
@After @After
@ -67,7 +67,7 @@ class StoryViewerViewModelTest {
testScheduler.triggerActions() testScheduler.triggerActions()
// THEN // THEN
verify(repository, never()).getStories(any(), any(), any()) verify(repository, never()).getStories(any(), any())
assertEquals(injectedStories, testSubject.stateSnapshot.pages) assertEquals(injectedStories, testSubject.stateSnapshot.pages)
} }
@ -76,7 +76,7 @@ class StoryViewerViewModelTest {
// GIVEN // GIVEN
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from) val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
val startStory = RecipientId.from(2L) val startStory = RecipientId.from(2L)
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories)) whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
// WHEN // WHEN
val testSubject = StoryViewerViewModel( val testSubject = StoryViewerViewModel(
@ -100,7 +100,7 @@ class StoryViewerViewModelTest {
// GIVEN // GIVEN
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from) val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
val startStory = RecipientId.from(1L) val startStory = RecipientId.from(1L)
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories)) whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
val testSubject = StoryViewerViewModel( val testSubject = StoryViewerViewModel(
StoryViewerArgs( StoryViewerArgs(
recipientId = startStory, recipientId = startStory,
@ -127,7 +127,7 @@ class StoryViewerViewModelTest {
// GIVEN // GIVEN
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from) val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
val startStory = stories.last() val startStory = stories.last()
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories)) whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
val testSubject = StoryViewerViewModel( val testSubject = StoryViewerViewModel(
StoryViewerArgs( StoryViewerArgs(
recipientId = startStory, recipientId = startStory,
@ -154,7 +154,7 @@ class StoryViewerViewModelTest {
// GIVEN // GIVEN
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from) val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
val startStory = stories.last() val startStory = stories.last()
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories)) whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
val testSubject = StoryViewerViewModel( val testSubject = StoryViewerViewModel(
StoryViewerArgs( StoryViewerArgs(
recipientId = startStory, recipientId = startStory,
@ -181,7 +181,7 @@ class StoryViewerViewModelTest {
// GIVEN // GIVEN
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from) val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
val startStory = stories.first() val startStory = stories.first()
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories)) whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
val testSubject = StoryViewerViewModel( val testSubject = StoryViewerViewModel(
StoryViewerArgs( StoryViewerArgs(
recipientId = startStory, recipientId = startStory,
@ -208,7 +208,7 @@ class StoryViewerViewModelTest {
// GIVEN // GIVEN
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from) val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
val startStory = stories.first() val startStory = stories.first()
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories)) whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
val testSubject = StoryViewerViewModel( val testSubject = StoryViewerViewModel(
StoryViewerArgs( StoryViewerArgs(
recipientId = startStory, recipientId = startStory,

Wyświetl plik

@ -42,7 +42,7 @@ class StoryViewerPageViewModelTest {
fun `Given first page and first post, when I goToPreviousPost, then I expect storyIndex to be 0`() { fun `Given first page and first post, when I goToPreviousPost, then I expect storyIndex to be 0`() {
// GIVEN // GIVEN
val storyPosts = createStoryPosts(3) { true } val storyPosts = createStoryPosts(3) { true }
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts)) whenever(repository.getStoryPostsFor(any(), any())).thenReturn(Observable.just(storyPosts))
val testSubject = createTestSubject() val testSubject = createTestSubject()
testSubject.setIsFirstPage(true) testSubject.setIsFirstPage(true)
testScheduler.triggerActions() testScheduler.triggerActions()
@ -61,7 +61,7 @@ class StoryViewerPageViewModelTest {
fun `Given first page and second post, when I goToPreviousPost, then I expect storyIndex to be 0`() { fun `Given first page and second post, when I goToPreviousPost, then I expect storyIndex to be 0`() {
// GIVEN // GIVEN
val storyPosts = createStoryPosts(3) { true } val storyPosts = createStoryPosts(3) { true }
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts)) whenever(repository.getStoryPostsFor(any(), any())).thenReturn(Observable.just(storyPosts))
val testSubject = createTestSubject() val testSubject = createTestSubject()
testSubject.setIsFirstPage(true) testSubject.setIsFirstPage(true)
testScheduler.triggerActions() testScheduler.triggerActions()
@ -82,7 +82,7 @@ class StoryViewerPageViewModelTest {
fun `Given no initial story and 3 records all viewed, when I initialize, then I expect storyIndex to be 0`() { fun `Given no initial story and 3 records all viewed, when I initialize, then I expect storyIndex to be 0`() {
// GIVEN // GIVEN
val storyPosts = createStoryPosts(3) { true } val storyPosts = createStoryPosts(3) { true }
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts)) whenever(repository.getStoryPostsFor(any(), any())).thenReturn(Observable.just(storyPosts))
// WHEN // WHEN
val testSubject = createTestSubject() val testSubject = createTestSubject()
@ -98,7 +98,7 @@ class StoryViewerPageViewModelTest {
fun `Given no initial story and 3 records all not viewed, when I initialize, then I expect storyIndex to be 0`() { fun `Given no initial story and 3 records all not viewed, when I initialize, then I expect storyIndex to be 0`() {
// GIVEN // GIVEN
val storyPosts = createStoryPosts(3) { false } val storyPosts = createStoryPosts(3) { false }
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts)) whenever(repository.getStoryPostsFor(any(), any())).thenReturn(Observable.just(storyPosts))
// WHEN // WHEN
val testSubject = createTestSubject() val testSubject = createTestSubject()
@ -114,7 +114,7 @@ class StoryViewerPageViewModelTest {
fun `Given no initial story and 3 records with 2nd is not viewed, when I initialize, then I expect storyIndex to be 1`() { fun `Given no initial story and 3 records with 2nd is not viewed, when I initialize, then I expect storyIndex to be 1`() {
// GIVEN // GIVEN
val storyPosts = createStoryPosts(3) { it % 2 != 0 } val storyPosts = createStoryPosts(3) { it % 2 != 0 }
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts)) whenever(repository.getStoryPostsFor(any(), any())).thenReturn(Observable.just(storyPosts))
// WHEN // WHEN
val testSubject = createTestSubject() val testSubject = createTestSubject()
@ -130,7 +130,7 @@ class StoryViewerPageViewModelTest {
fun `Given no initial story and 3 records with 1st and 3rd not viewed, when I goToNext, then I expect storyIndex to be 2`() { fun `Given no initial story and 3 records with 1st and 3rd not viewed, when I goToNext, then I expect storyIndex to be 2`() {
// GIVEN // GIVEN
val storyPosts = createStoryPosts(3) { it % 2 == 0 } val storyPosts = createStoryPosts(3) { it % 2 == 0 }
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts)) whenever(repository.getStoryPostsFor(any(), any())).thenReturn(Observable.just(storyPosts))
// WHEN // WHEN
val testSubject = createTestSubject() val testSubject = createTestSubject()
@ -148,7 +148,7 @@ class StoryViewerPageViewModelTest {
fun `Given a single story, when I goToPrevious, then I expect storyIndex to be -1`() { fun `Given a single story, when I goToPrevious, then I expect storyIndex to be -1`() {
// GIVEN // GIVEN
val storyPosts = createStoryPosts(1) val storyPosts = createStoryPosts(1)
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts)) whenever(repository.getStoryPostsFor(any(), any())).thenReturn(Observable.just(storyPosts))
// WHEN // WHEN
val testSubject = createTestSubject() val testSubject = createTestSubject()
@ -167,7 +167,6 @@ class StoryViewerPageViewModelTest {
RecipientId.from(1), RecipientId.from(1),
-1L, -1L,
false, false,
false,
repository, repository,
mock() mock()
) )