Search in sources :

Example 1 with MessageThread

use of com.kickstarter.models.MessageThread in project android-oss by kickstarter.

the class MessagesViewModelTest method testConfiguredWithThread.

@Test
public void testConfiguredWithThread() {
    final MessageThread messageThread = MessageThreadFactory.messageThread();
    setUpEnvironment(environment().toBuilder().currentUser(new MockCurrentUser(UserFactory.user())).build());
    // Start the view model with a message thread.
    this.vm.intent(messagesContextIntent(messageThread));
    this.backingAndProject.assertValueCount(1);
    this.messageList.assertValueCount(1);
}
Also used : MessageThread(com.kickstarter.models.MessageThread) MockCurrentUser(com.kickstarter.libs.MockCurrentUser) Test(org.junit.Test)

Example 2 with MessageThread

use of com.kickstarter.models.MessageThread in project android-oss by kickstarter.

the class MessageThreadHolderViewModelTest method testEmitsParticipantData.

@Test
public void testEmitsParticipantData() {
    final MessageThread messageThread = MessageThreadFactory.messageThread();
    setUpEnvironment(environment());
    // Configure the view model with a message thread.
    this.vm.inputs.configureWith(messageThread);
    // Emits participant's avatar url and name.
    this.participantAvatarUrl.assertValues(messageThread.participant().avatar().medium());
    this.participantNameTextViewText.assertValues(messageThread.participant().name());
}
Also used : MessageThread(com.kickstarter.models.MessageThread) Test(org.junit.Test)

Example 3 with MessageThread

use of com.kickstarter.models.MessageThread in project android-oss by kickstarter.

the class MessageThreadHolderViewModelTest method testStartMessagesActivity.

@Test
public void testStartMessagesActivity() {
    final MessageThread messageThread = MessageThreadFactory.messageThread();
    setUpEnvironment(environment());
    // Configure the view model with a message thread.
    this.vm.inputs.configureWith(messageThread);
    this.vm.inputs.messageThreadCardViewClicked();
    this.startMessagesActivity.assertValues(messageThread);
}
Also used : MessageThread(com.kickstarter.models.MessageThread) Test(org.junit.Test)

Example 4 with MessageThread

use of com.kickstarter.models.MessageThread in project android-oss by kickstarter.

the class MessageThreadHolderViewModelTest method testEmitsDateTime.

@Test
public void testEmitsDateTime() {
    final MessageThread messageThread = MessageThreadFactory.messageThread();
    setUpEnvironment(environment());
    // Configure the view model with a message thread.
    this.vm.inputs.configureWith(messageThread);
    this.dateDateTime.assertValues(messageThread.lastMessage().createdAt());
}
Also used : MessageThread(com.kickstarter.models.MessageThread) Test(org.junit.Test)

Example 5 with MessageThread

use of com.kickstarter.models.MessageThread in project android-oss by kickstarter.

the class MessageThreadHolderViewModelTest method testEmitsMessageBodyTextViewText.

@Test
public void testEmitsMessageBodyTextViewText() {
    final MessageThread messageThread = MessageThreadFactory.messageThread();
    setUpEnvironment(environment());
    // Configure the view model with a message thread.
    this.vm.inputs.configureWith(messageThread);
    this.messageBodyTextViewText.assertValues(messageThread.lastMessage().body());
}
Also used : MessageThread(com.kickstarter.models.MessageThread) Test(org.junit.Test)

Aggregations

MessageThread (com.kickstarter.models.MessageThread)17 Test (org.junit.Test)17 MockCurrentUser (com.kickstarter.libs.MockCurrentUser)10 NonNull (androidx.annotation.NonNull)9 MockApiClient (com.kickstarter.mock.services.MockApiClient)9 MessageThreadEnvelope (com.kickstarter.services.apiresponses.MessageThreadEnvelope)7 User (com.kickstarter.models.User)5 Backing (com.kickstarter.models.Backing)4 Project (com.kickstarter.models.Project)4 BackingWrapper (com.kickstarter.models.BackingWrapper)2 CurrentUserType (com.kickstarter.libs.CurrentUserType)1