use of com.kickstarter.services.apiresponses.ProjectsEnvelope in project android-oss by kickstarter.
the class CreatorDashboardViewModelTest method testProjectName_whenMultipleProjects.
@Test
public void testProjectName_whenMultipleProjects() {
final Project project1 = ProjectFactory.project().toBuilder().name("Best Project 2K19").build();
final Project project2 = ProjectFactory.project();
final List<Project> projects = Arrays.asList(project1, project2);
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<ProjectsEnvelope> fetchProjects(final boolean member) {
return Observable.just(ProjectsEnvelopeFactory.projectsEnvelope(projects));
}
};
setUpEnvironment(environment().toBuilder().apiClient(apiClient).build());
this.vm.intent(new Intent());
this.projectName.assertValue("Best Project 2K19");
}
use of com.kickstarter.services.apiresponses.ProjectsEnvelope in project android-oss by kickstarter.
the class CreatorDashboardViewModelTest method testProjectSwitcherProjectClickOutput.
@Test
public void testProjectSwitcherProjectClickOutput() {
DateTimeUtils.setCurrentMillisFixed(new DateTime().getMillis());
final Project project1 = ProjectFactory.project();
final Project project2 = ProjectFactory.project();
final List<Project> projects = Arrays.asList(project1, project2);
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.vm.inputs.projectSelectionInput(project2);
this.projectDashboardData.assertValues(new ProjectDashboardData(project1, ProjectStatsEnvelopeFactory.projectStatsEnvelope(), false), new ProjectDashboardData(project2, ProjectStatsEnvelopeFactory.projectStatsEnvelope(), false));
}
use of com.kickstarter.services.apiresponses.ProjectsEnvelope 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.services.apiresponses.ProjectsEnvelope in project android-oss by kickstarter.
the class CreatorDashboardViewModelTest method testProjectsForBottomSheet_With1Project.
@Test
public void testProjectsForBottomSheet_With1Project() {
final List<Project> projects = Collections.singletonList(ProjectFactory.project());
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<ProjectsEnvelope> fetchProjects(final boolean member) {
return Observable.just(ProjectsEnvelopeFactory.projectsEnvelope(projects));
}
};
setUpEnvironment(environment().toBuilder().apiClient(apiClient).build());
this.projectsForBottomSheet.assertNoValues();
}
use of com.kickstarter.services.apiresponses.ProjectsEnvelope in project android-oss by kickstarter.
the class CreatorDashboardViewModelTest method testProjectsForBottomSheet_WithManyProjects.
@Test
public void testProjectsForBottomSheet_WithManyProjects() {
final Project project1 = ProjectFactory.project();
final Project project2 = ProjectFactory.project();
final List<Project> projects = Arrays.asList(project1, project2);
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<ProjectsEnvelope> fetchProjects(final boolean member) {
return Observable.just(ProjectsEnvelopeFactory.projectsEnvelope(projects));
}
};
setUpEnvironment(environment().toBuilder().apiClient(apiClient).build());
this.vm.intent(new Intent());
this.projectsForBottomSheet.assertValue(Collections.singletonList(project2));
}
Aggregations