use of com.kickstarter.services.DiscoveryParams in project android-oss by kickstarter.
the class ThanksViewModelTest method testThanksViewModel_startDiscovery.
@Test
public void testThanksViewModel_startDiscovery() {
final ThanksViewModel vm = new ThanksViewModel(environment());
final Category category = CategoryFactory.category();
final TestSubscriber<DiscoveryParams> startDiscoveryTest = new TestSubscriber<>();
vm.outputs.startDiscovery().subscribe(startDiscoveryTest);
vm.inputs.categoryClick(null, category);
startDiscoveryTest.assertValues(DiscoveryParams.builder().category(category).build());
koalaTest.assertValue("Checkout Finished Discover More");
}
use of com.kickstarter.services.DiscoveryParams in project android-oss by kickstarter.
the class ProfileViewModelTest method testProfileViewModel_EmitsProjects.
@Test
public void testProfileViewModel_EmitsProjects() {
final ApiClientType apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<DiscoverEnvelope> fetchProjects(@NonNull final DiscoveryParams params) {
return Observable.just(DiscoverEnvelopeFactory.discoverEnvelope(Collections.singletonList(ProjectFactory.project())));
}
};
final Environment env = environment().toBuilder().apiClient(apiClient).build();
final ProfileViewModel.ViewModel vm = new ProfileViewModel.ViewModel(env);
final TestSubscriber<List<Project>> projects = new TestSubscriber<>();
vm.outputs.projects().subscribe(projects);
koalaTest.assertValues(KoalaEvent.PROFILE_VIEW_MY, KoalaEvent.VIEWED_PROFILE);
projects.assertValueCount(1);
}
use of com.kickstarter.services.DiscoveryParams in project android-oss by kickstarter.
the class DiscoveryIntentMapperTest method emitsFromDiscoveryCategoryUri.
@Test
public void emitsFromDiscoveryCategoryUri() {
final Uri uri = Uri.parse("https://www.kickstarter.com/discover/categories/music");
final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
final TestSubscriber<DiscoveryParams> resultTest = TestSubscriber.create();
DiscoveryIntentMapper.params(intent, new MockApiClient()).subscribe(resultTest);
resultTest.assertValueCount(1);
}
use of com.kickstarter.services.DiscoveryParams in project android-oss by kickstarter.
the class DiscoveryIntentMapperTest method emitsFromDiscoveryLocationUri.
@Test
public void emitsFromDiscoveryLocationUri() {
final Uri uri = Uri.parse("https://www.kickstarter.com/discover/places/sydney-au");
final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
final TestSubscriber<DiscoveryParams> resultTest = TestSubscriber.create();
DiscoveryIntentMapper.params(intent, new MockApiClient()).subscribe(resultTest);
resultTest.assertValueCount(1);
}
use of com.kickstarter.services.DiscoveryParams in project android-oss by kickstarter.
the class DiscoveryIntentMapperTest method emitsFromParamsExtra.
@Test
public void emitsFromParamsExtra() {
final DiscoveryParams params = DiscoveryParams.builder().build();
final Intent intent = new Intent().putExtra(IntentKey.DISCOVERY_PARAMS, params);
final TestSubscriber<DiscoveryParams> resultTest = TestSubscriber.create();
DiscoveryIntentMapper.params(intent, new MockApiClient()).subscribe(resultTest);
resultTest.assertValues(params);
}
Aggregations