use of com.kickstarter.mock.MockExperimentsClientType in project android-oss by kickstarter.
the class DiscoveryFragmentViewModelTest method testStartProjectActivity_whenFeatureFlagEnabled_shouldEmitProjectPageActivity.
@Test
public void testStartProjectActivity_whenFeatureFlagEnabled_shouldEmitProjectPageActivity() {
final CurrentUserType currentUser = new MockCurrentUser();
final MockExperimentsClientType mockExperimentsClientType = new MockExperimentsClientType() {
@Override
public boolean isFeatureEnabled(@NotNull final OptimizelyFeature.Key feature) {
return true;
}
};
this.setUpEnvironment(this.environment().toBuilder().currentUser(currentUser).optimizely(mockExperimentsClientType).build());
// Load initial params and root categories from activity.
setUpInitialHomeAllProjectsParams();
// Click on project
final Project project = ProjectFactory.project();
this.vm.inputs.projectCardViewHolderClicked(project);
this.startProjectActivity.assertValueCount(1);
assertEquals(this.startProjectActivity.getOnNextEvents().get(0).first, project);
assertEquals(this.startProjectActivity.getOnNextEvents().get(0).second, RefTag.discovery());
this.segmentTrack.assertValues(EventName.PAGE_VIEWED.getEventName(), EventName.CARD_CLICKED.getEventName(), EventName.CTA_CLICKED.getEventName());
}
Aggregations