Search in sources :

Example 11 with ProjectStatsEnvelope

use of com.kickstarter.services.apiresponses.ProjectStatsEnvelope in project android-oss by kickstarter.

the class CreatorDashboardHeaderHolderViewModelTest method testProjectBackersCountText.

@Test
public void testProjectBackersCountText() {
    final Project project = ProjectFactory.project().toBuilder().backersCount(10).build();
    final ProjectStatsEnvelope projectStatsEnvelope = ProjectStatsEnvelopeFactory.projectStatsEnvelope();
    setUpEnvironment(environment());
    this.vm.inputs.configureWith(new ProjectDashboardData(project, projectStatsEnvelope, false));
    this.projectBackersCountText.assertValue("10");
}
Also used : Project(com.kickstarter.models.Project) ProjectStatsEnvelope(com.kickstarter.services.apiresponses.ProjectStatsEnvelope) ProjectDashboardData(com.kickstarter.ui.adapters.data.ProjectDashboardData) Test(org.junit.Test)

Example 12 with ProjectStatsEnvelope

use of com.kickstarter.services.apiresponses.ProjectStatsEnvelope in project android-oss by kickstarter.

the class CreatorDashboardHeaderHolderViewModelTest method getDashboardDataForProjectState.

private ProjectDashboardData getDashboardDataForProjectState(@Project.State final String state) {
    final ProjectStatsEnvelope projectStatsEnvelope = ProjectStatsEnvelopeFactory.projectStatsEnvelope();
    final Project project = ProjectFactory.project().toBuilder().state(state).build();
    return new ProjectDashboardData(project, projectStatsEnvelope, false);
}
Also used : Project(com.kickstarter.models.Project) ProjectStatsEnvelope(com.kickstarter.services.apiresponses.ProjectStatsEnvelope) ProjectDashboardData(com.kickstarter.ui.adapters.data.ProjectDashboardData)

Example 13 with ProjectStatsEnvelope

use of com.kickstarter.services.apiresponses.ProjectStatsEnvelope in project android-oss by kickstarter.

the class CreatorDashboardHeaderHolderViewModelTest method testStartProjectActivity.

@Test
public void testStartProjectActivity() {
    final Project project = ProjectFactory.project();
    final ProjectStatsEnvelope projectStatsEnvelope = ProjectStatsEnvelopeFactory.projectStatsEnvelope();
    setUpEnvironment(environment());
    this.vm.inputs.configureWith(new ProjectDashboardData(project, projectStatsEnvelope, false));
    this.vm.inputs.projectButtonClicked();
    this.startProjectActivity.assertValueCount(1);
    assertEquals(this.startProjectActivity.getOnNextEvents().get(0).first, project);
    assertEquals(this.startProjectActivity.getOnNextEvents().get(0).second, RefTag.dashboard());
}
Also used : Project(com.kickstarter.models.Project) ProjectStatsEnvelope(com.kickstarter.services.apiresponses.ProjectStatsEnvelope) ProjectDashboardData(com.kickstarter.ui.adapters.data.ProjectDashboardData) Test(org.junit.Test)

Example 14 with ProjectStatsEnvelope

use of com.kickstarter.services.apiresponses.ProjectStatsEnvelope in project android-oss by kickstarter.

the class CreatorDashboardHeaderHolderViewModelTest method testMessagesButtonIsGone_whenCurrentUserIsCollaborator.

@Test
public void testMessagesButtonIsGone_whenCurrentUserIsCollaborator() {
    final User creator = UserFactory.creator();
    final CurrentUserType currentUser = new MockCurrentUser(UserFactory.collaborator());
    final Project project = ProjectFactory.project().toBuilder().creator(creator).build();
    final ProjectStatsEnvelope projectStatsEnvelope = ProjectStatsEnvelopeFactory.projectStatsEnvelope();
    setUpEnvironment(environment().toBuilder().currentUser(currentUser).build());
    this.vm.inputs.configureWith(new ProjectDashboardData(project, projectStatsEnvelope, false));
    // Messages button is gone if current user is not the project creator (e.g. a collaborator).
    this.messagesButtonIsGone.assertValue(true);
}
Also used : Project(com.kickstarter.models.Project) User(com.kickstarter.models.User) MockCurrentUser(com.kickstarter.libs.MockCurrentUser) ProjectStatsEnvelope(com.kickstarter.services.apiresponses.ProjectStatsEnvelope) CurrentUserType(com.kickstarter.libs.CurrentUserType) MockCurrentUser(com.kickstarter.libs.MockCurrentUser) ProjectDashboardData(com.kickstarter.ui.adapters.data.ProjectDashboardData) Test(org.junit.Test)

Example 15 with ProjectStatsEnvelope

use of com.kickstarter.services.apiresponses.ProjectStatsEnvelope in project android-oss by kickstarter.

the class CreatorDashboardReferrerBreakdownHolderViewModelTest method setUpEnvironmentAndInputProjectAndEmptyStats.

@NonNull
private Project setUpEnvironmentAndInputProjectAndEmptyStats() {
    final Project project = ProjectFactory.project();
    final ProjectStatsEnvelope projectStatsEnvelope = getEmptyProjectStatsEnvelope();
    setUpEnvironment(environment());
    this.vm.inputs.projectAndStatsInput(Pair.create(project, projectStatsEnvelope));
    return project;
}
Also used : Project(com.kickstarter.models.Project) ProjectStatsEnvelope(com.kickstarter.services.apiresponses.ProjectStatsEnvelope) NonNull(androidx.annotation.NonNull)

Aggregations

Project (com.kickstarter.models.Project)16 ProjectStatsEnvelope (com.kickstarter.services.apiresponses.ProjectStatsEnvelope)16 ProjectDashboardData (com.kickstarter.ui.adapters.data.ProjectDashboardData)11 Test (org.junit.Test)10 NonNull (androidx.annotation.NonNull)5 Intent (android.content.Intent)3 MockApiClient (com.kickstarter.mock.services.MockApiClient)3 CurrentUserType (com.kickstarter.libs.CurrentUserType)2 MockCurrentUser (com.kickstarter.libs.MockCurrentUser)2 ProjectsEnvelope (com.kickstarter.services.apiresponses.ProjectsEnvelope)2 DateTime (org.joda.time.DateTime)2 MockExperimentsClientType (com.kickstarter.mock.MockExperimentsClientType)1 User (com.kickstarter.models.User)1 NotNull (org.jetbrains.annotations.NotNull)1