mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 11:51:10 +01:00
Only display outgoing messages when entering viewer through my stories.
This commit is contained in:
committed by
Cody Henthorne
parent
d40be0abf8
commit
cb7b2d90d5
@@ -66,7 +66,7 @@ class StoryViewerViewModelTest {
|
||||
testScheduler.triggerActions()
|
||||
|
||||
// THEN
|
||||
verify(repository, never()).getStories(any(), any())
|
||||
verify(repository, never()).getStories(any(), any(), any())
|
||||
assertEquals(injectedStories, testSubject.stateSnapshot.pages)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = RecipientId.from(2L)
|
||||
whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
|
||||
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories))
|
||||
|
||||
// WHEN
|
||||
val testSubject = StoryViewerViewModel(
|
||||
@@ -99,7 +99,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = RecipientId.from(1L)
|
||||
whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
|
||||
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
@@ -125,7 +125,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = stories.last()
|
||||
whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
|
||||
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
@@ -151,7 +151,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = stories.last()
|
||||
whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
|
||||
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
@@ -177,7 +177,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = stories.first()
|
||||
whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
|
||||
whenever(repository.getStories(any(), any(), any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(
|
||||
StoryViewerArgs(
|
||||
recipientId = startStory,
|
||||
@@ -203,7 +203,7 @@ class StoryViewerViewModelTest {
|
||||
// GIVEN
|
||||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = stories.first()
|
||||
whenever(repository.getStories(any(), any())).doReturn(Single.just(stories))
|
||||
whenever(repository.getStories(any(), 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())).thenReturn(Observable.just(storyPosts))
|
||||
whenever(repository.getStoryPostsFor(any(), 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())).thenReturn(Observable.just(storyPosts))
|
||||
whenever(repository.getStoryPostsFor(any(), 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())).thenReturn(Observable.just(storyPosts))
|
||||
whenever(repository.getStoryPostsFor(any(), 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())).thenReturn(Observable.just(storyPosts))
|
||||
whenever(repository.getStoryPostsFor(any(), 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())).thenReturn(Observable.just(storyPosts))
|
||||
whenever(repository.getStoryPostsFor(any(), 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())).thenReturn(Observable.just(storyPosts))
|
||||
whenever(repository.getStoryPostsFor(any(), 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())).thenReturn(Observable.just(storyPosts))
|
||||
whenever(repository.getStoryPostsFor(any(), any(), any())).thenReturn(Observable.just(storyPosts))
|
||||
|
||||
// WHEN
|
||||
val testSubject = createTestSubject()
|
||||
@@ -167,6 +167,7 @@ class StoryViewerPageViewModelTest {
|
||||
RecipientId.from(1),
|
||||
-1L,
|
||||
false,
|
||||
false,
|
||||
repository,
|
||||
mock()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user