use of com.kickstarter.models.SurveyResponse in project android-oss by kickstarter.
the class SurveyHolderViewModelTest method testCreatorNameEmits.
@Test
public void testCreatorNameEmits() {
final SurveyResponse surveyResponse = SurveyResponseFactory.surveyResponse();
setUpEnvironment(environment());
this.vm.inputs.configureWith(surveyResponse);
this.creatorNameTextViewText.assertValues(surveyResponse.project().creator().name());
}
use of com.kickstarter.models.SurveyResponse in project android-oss by kickstarter.
the class SurveyResponseViewModelTest method testWebViewUrl.
@Test
public void testWebViewUrl() {
final SurveyResponse surveyResponse = SurveyResponseFactory.surveyResponse();
setUpEnvironment(environment());
this.vm.intent(new Intent().putExtra(IntentKey.SURVEY_RESPONSE, surveyResponse));
this.webViewUrl.assertValues(surveyResponse.urls().web().survey());
}
use of com.kickstarter.models.SurveyResponse in project android-oss by kickstarter.
the class SurveyResponseViewModelTest method testSubmitSuccessful_NullTag_ShowConfirmationDialog.
@Test
public void testSubmitSuccessful_NullTag_ShowConfirmationDialog() {
final String surveyUrl = "https://kck.str/projects/param/heyo/surveys/123";
final SurveyResponse.Urls urlsEnvelope = SurveyResponse.Urls.builder().web(SurveyResponse.Urls.Web.builder().survey(surveyUrl).build()).build();
final SurveyResponse surveyResponse = SurveyResponseFactory.surveyResponse().toBuilder().urls(urlsEnvelope).build();
final Request projectSurveyRequest = new Request.Builder().url(surveyUrl).build();
final Request projectRequest = new Request.Builder().url("https://kck.str/projects/param/heyo").build();
setUpEnvironment(environment());
this.vm.intent(new Intent().putExtra(IntentKey.SURVEY_RESPONSE, surveyResponse));
// Survey loads. Successful submit redirects to project uri.
this.vm.inputs.projectSurveyUriRequest(projectSurveyRequest);
this.vm.inputs.projectUriRequest(projectRequest);
// Success confirmation dialog is shown.
this.showConfirmationDialog.assertValueCount(1);
}
use of com.kickstarter.models.SurveyResponse in project android-oss by kickstarter.
the class SurveyResponseViewModelTest method testSubmitSuccessful_Redirect_ShowConfirmationDialog.
@Test
public void testSubmitSuccessful_Redirect_ShowConfirmationDialog() {
final String surveyUrl = "https://kck.str/projects/param/heyo/surveys/123";
final SurveyResponse.Urls urlsEnvelope = SurveyResponse.Urls.builder().web(SurveyResponse.Urls.Web.builder().survey(surveyUrl).build()).build();
final SurveyResponse surveyResponse = SurveyResponseFactory.surveyResponse().toBuilder().urls(urlsEnvelope).build();
final Request projectSurveyRequest = new Request.Builder().url(surveyUrl).build();
final Request projectRequest = new Request.Builder().url("https://kck.str/projects/param/heyo").tag(projectSurveyRequest).build();
setUpEnvironment(environment());
this.vm.intent(new Intent().putExtra(IntentKey.SURVEY_RESPONSE, surveyResponse));
// Survey loads. Successful submit redirects to project uri.
this.vm.inputs.projectSurveyUriRequest(projectSurveyRequest);
this.vm.inputs.projectUriRequest(projectRequest);
// Success confirmation dialog is shown.
this.showConfirmationDialog.assertValueCount(1);
}
use of com.kickstarter.models.SurveyResponse in project android-oss by kickstarter.
the class ActivityFeedViewModelTest method testSurveys_LoggedOut.
@Test
public void testSurveys_LoggedOut() {
final List<SurveyResponse> surveyResponses = Arrays.asList(SurveyResponseFactory.surveyResponse(), SurveyResponseFactory.surveyResponse());
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<List<SurveyResponse>> fetchUnansweredSurveys() {
return Observable.just(surveyResponses);
}
};
final CurrentUserType currentUser = new MockCurrentUser();
currentUser.logout();
final Environment environment = this.environment().toBuilder().apiClient(apiClient).currentUser(currentUser).build();
setUpEnvironment(environment);
this.vm.inputs.resume();
this.surveys.assertNoValues();
}
Aggregations