mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Fix story unit test compilation.
This commit is contained in:
committed by
Cody Henthorne
parent
8eebdaf451
commit
2566d6f61f
@@ -41,7 +41,7 @@ class StoryViewerViewModelTest {
|
||||
RxJavaPlugins.setInitComputationSchedulerHandler { testScheduler }
|
||||
RxJavaPlugins.setComputationSchedulerHandler { testScheduler }
|
||||
|
||||
whenever(repository.getFirstStory(any(), any(), any())).doReturn(Single.just(mock()))
|
||||
whenever(repository.getFirstStory(any(), any())).doReturn(Single.just(mock()))
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -67,7 +67,7 @@ class StoryViewerViewModelTest {
|
||||
testScheduler.triggerActions()
|
||||
|
||||
// THEN
|
||||
verify(repository, never()).getStories(any(), any(), any())
|
||||
verify(repository, never()).getStories(any(), any())
|
||||
assertEquals(injectedStories, testSubject.stateSnapshot.pages)
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
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
|
||||
val testSubject = StoryViewerViewModel(
|
||||
@@ -100,7 +100,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
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(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
@@ -127,7 +127,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
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(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
@@ -154,7 +154,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
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(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
@@ -181,7 +181,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
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(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
@@ -208,7 +208,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
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(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
|
||||
@@ -42,7 +42,7 @@ class StoryViewerPageViewModelTest {
|
||||
fun `Given first page and first post, when I goToPreviousPost, then I expect storyIndex to be 0`() {
|
||||
// GIVEN
|
||||
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()
|
||||
testSubject.setIsFirstPage(true)
|
||||
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`() {
|
||||
// GIVEN
|
||||
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()
|
||||
testSubject.setIsFirstPage(true)
|
||||
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`() {
|
||||
// GIVEN
|
||||
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
|
||||
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`() {
|
||||
// GIVEN
|
||||
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
|
||||
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`() {
|
||||
// GIVEN
|
||||
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
|
||||
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`() {
|
||||
// GIVEN
|
||||
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
|
||||
val testSubject = createTestSubject()
|
||||
@@ -148,7 +148,7 @@ class StoryViewerPageViewModelTest {
|
||||
fun `Given a single story, when I goToPrevious, then I expect storyIndex to be -1`() {
|
||||
// GIVEN
|
||||
val storyPosts = createStoryPosts(1)
|
||||
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts))
|
||||
whenever(repository.getStoryPostsFor(any(), any())).thenReturn(Observable.just(storyPosts))
|
||||
|
||||
// WHEN
|
||||
val testSubject = createTestSubject()
|
||||
@@ -167,7 +167,6 @@ class StoryViewerPageViewModelTest {
|
||||
RecipientId.from(1),
|
||||
-1L,
|
||||
false,
|
||||
false,
|
||||
repository,
|
||||
mock()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user