use of com.kickstarter.ui.adapters.data.ProjectDashboardData in project android-oss by kickstarter.
the class CreatorDashboardViewModelTest method testProjectDashboardData_whenViewingAllProjects.
public void testProjectDashboardData_whenViewingAllProjects() {
final List<Project> projects = Collections.singletonList(ProjectFactory.project());
final ProjectStatsEnvelope projectStatsEnvelope = ProjectStatsEnvelopeFactory.projectStatsEnvelope();
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<ProjectsEnvelope> fetchProjects(final boolean member) {
return Observable.just(ProjectsEnvelopeFactory.projectsEnvelope(projects));
}
@Override
@NonNull
public Observable<ProjectStatsEnvelope> fetchProjectStats(@NonNull final Project project) {
return Observable.just(projectStatsEnvelope);
}
};
setUpEnvironment(environment().toBuilder().apiClient(apiClient).build());
this.vm.intent(new Intent());
this.projectDashboardData.assertValue(new ProjectDashboardData(Objects.requireNonNull(ListUtils.first(projects)), projectStatsEnvelope, false));
}
use of com.kickstarter.ui.adapters.data.ProjectDashboardData in project android-oss by kickstarter.
the class CreatorDashboardHeaderHolderViewModelTest method testOtherProjectsButtonIsGone_whenCurrentUserIsMemberOfManyProjects_viewingAllProjects.
@Test
public void testOtherProjectsButtonIsGone_whenCurrentUserIsMemberOfManyProjects_viewingAllProjects() {
final CurrentUserType collaborator = new MockCurrentUser(UserFactory.collaborator());
setUpEnvironment(environment().toBuilder().currentUser(collaborator).build());
this.vm.inputs.configureWith(new ProjectDashboardData(ProjectFactory.project(), ProjectStatsEnvelopeFactory.projectStatsEnvelope(), false));
this.otherProjectsButtonIsGone.assertValue(false);
}
use of com.kickstarter.ui.adapters.data.ProjectDashboardData 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");
}
use of com.kickstarter.ui.adapters.data.ProjectDashboardData in project android-oss by kickstarter.
the class CreatorDashboardHeaderHolderViewModelTest method testMessagesButtonIsGone_whenCurrentUserIsProjectCreator.
@Test
public void testMessagesButtonIsGone_whenCurrentUserIsProjectCreator() {
final User creator = UserFactory.creator();
final CurrentUserType currentUser = new MockCurrentUser(creator);
final Project project = ProjectFactory.project().toBuilder().creator(creator).build();
setUpEnvironment(environment().toBuilder().currentUser(currentUser).build());
this.vm.inputs.configureWith(new ProjectDashboardData(project, ProjectStatsEnvelopeFactory.projectStatsEnvelope(), false));
// Messages button is shown to project creator.
this.messagesButtonIsGone.assertValues(false);
}
use of com.kickstarter.ui.adapters.data.ProjectDashboardData 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);
}
Aggregations