use of com.kickstarter.ui.data.CheckoutData in project android-oss by kickstarter.
the class ThanksViewModelTest method testThanksViewModel_startProject.
@Test
public void testThanksViewModel_startProject() {
setUpEnvironment(environment());
final Project project = ProjectFactory.project();
final CheckoutData checkoutData = CheckoutDataFactory.Companion.checkoutData(3L, 20.0, 30.0);
final PledgeData pledgeData = PledgeData.Companion.with(PledgeFlowContext.NEW_PLEDGE, ProjectDataFactory.Companion.project(project), RewardFactory.reward(), Collections.emptyList(), null);
final Intent intent = new Intent().putExtra(IntentKey.CHECKOUT_DATA, checkoutData).putExtra(IntentKey.PLEDGE_DATA, pledgeData).putExtra(IntentKey.PROJECT, project);
this.vm.intent(intent);
this.vm.inputs.projectCardViewHolderClicked(project);
final Pair<Project, RefTag> projectPageParams = this.startProjectTest.getOnNextEvents().get(0);
assertEquals(projectPageParams.first, project);
assertEquals(projectPageParams.second, RefTag.thanks());
this.segmentTrack.assertValues(EventName.PAGE_VIEWED.getEventName(), EventName.CTA_CLICKED.getEventName());
}
use of com.kickstarter.ui.data.CheckoutData in project android-oss by kickstarter.
the class ThanksViewModelTest method testTracking_whenCheckoutDataAndPledgeDataExtrasPresent.
@Test
public void testTracking_whenCheckoutDataAndPledgeDataExtrasPresent() {
setUpEnvironment(environment());
final Project project = ProjectFactory.project();
final CheckoutData checkoutData = CheckoutDataFactory.Companion.checkoutData(3L, 20.0, 30.0);
final PledgeData pledgeData = PledgeData.Companion.with(PledgeFlowContext.NEW_PLEDGE, ProjectDataFactory.Companion.project(project), RewardFactory.reward(), Collections.emptyList(), null);
final Intent intent = new Intent().putExtra(IntentKey.CHECKOUT_DATA, checkoutData).putExtra(IntentKey.PLEDGE_DATA, pledgeData).putExtra(IntentKey.PROJECT, project);
this.vm.intent(intent);
this.segmentTrack.assertValue(EventName.PAGE_VIEWED.getEventName());
}
use of com.kickstarter.ui.data.CheckoutData in project android-oss by kickstarter.
the class ThanksViewModelTest method testThanksViewModel_whenFeatureFlagOn_shouldEmitProjectPage.
@Test
public void testThanksViewModel_whenFeatureFlagOn_shouldEmitProjectPage() {
final MockCurrentUser user = new MockCurrentUser();
final MockExperimentsClientType mockExperimentsClientType = new MockExperimentsClientType() {
@Override
public boolean isFeatureEnabled(@NotNull final OptimizelyFeature.Key feature) {
return true;
}
};
final Environment environment = environment().toBuilder().currentUser(user).optimizely(mockExperimentsClientType).build();
setUpEnvironment(environment);
final Project project = ProjectFactory.project();
final CheckoutData checkoutData = CheckoutDataFactory.Companion.checkoutData(3L, 20.0, 30.0);
final PledgeData pledgeData = PledgeData.Companion.with(PledgeFlowContext.NEW_PLEDGE, ProjectDataFactory.Companion.project(project), RewardFactory.reward(), Collections.emptyList(), null);
final Intent intent = new Intent().putExtra(IntentKey.CHECKOUT_DATA, checkoutData).putExtra(IntentKey.PLEDGE_DATA, pledgeData).putExtra(IntentKey.PROJECT, project);
this.vm.intent(intent);
this.vm.inputs.projectCardViewHolderClicked(project);
final Pair<Project, RefTag> projectPageParams = this.startProjectTest.getOnNextEvents().get(0);
assertEquals(projectPageParams.first, project);
assertEquals(projectPageParams.second, RefTag.thanks());
this.segmentTrack.assertValues(EventName.PAGE_VIEWED.getEventName(), EventName.CTA_CLICKED.getEventName());
}
Aggregations