package com.kickstarter.viewmodels;

import android.content.Intent;

import com.kickstarter.KSRobolectricTestCase;
import com.kickstarter.factories.ProjectFactory;
import com.kickstarter.models.Project;
import com.kickstarter.ui.IntentKey;

import org.junit.Test;

import rx.observers.TestSubscriber;

public final class ThanksViewModelTest extends KSRobolectricTestCase {
  @Test
  public void testThanksViewModel_projectName() {
    final ThanksViewModel vm = new ThanksViewModel(environment());
    final Project project = ProjectFactory.project();

    final TestSubscriber<String> projectNameTest = new TestSubscriber<>();
    vm.outputs.projectName().subscribe(projectNameTest);

    vm.intent(new Intent().putExtra(IntentKey.PROJECT, ProjectFactory.project()));
    projectNameTest.assertValues(project.name());
  }

  @Test
  public void testThanksViewModel_share() {
    final ThanksViewModel vm = new ThanksViewModel(environment());
    final Project project = ProjectFactory.project();

    final TestSubscriber<Project> startShareTest = new TestSubscriber<>();
    vm.outputs.startShare().subscribe(startShareTest);
    final TestSubscriber<Project> startShareOnFacebookTest = new TestSubscriber<>();
    vm.outputs.startShareOnFacebook().subscribe(startShareOnFacebookTest);
    final TestSubscriber<Project> startShareOnTwitterTest = new TestSubscriber<>();
    vm.outputs.startShareOnTwitter().subscribe(startShareOnTwitterTest);

    vm.intent(new Intent().putExtra(IntentKey.PROJECT, ProjectFactory.project()));

    vm.inputs.shareClick();
    startShareTest.assertValues(project);

    vm.inputs.shareOnFacebookClick();
    startShareOnFacebookTest.assertValues(project);

    vm.inputs.shareOnTwitterClick();
    startShareOnTwitterTest.assertValues(project);
  }
}

@@ -145,61 +145,200 @@
 ies.
-ProjectFactory;%0Aimport com.kickstarter.models.Project
+CategoryFactory;%0Aimport com.kickstarter.factories.ProjectFactory;%0Aimport com.kickstarter.models.Category;%0Aimport com.kickstarter.models.Project;%0Aimport com.kickstarter.services.DiscoveryParams
 ;%0Aim
@@ -1915,11 +1915,490 @@
 ct);%0A  %7D
+%0A%0A  @Test%0A  public void testThanksViewModel_startDiscovery() %7B%0A    final ThanksViewModel vm = new ThanksViewModel(environment());%0A    final Category category = CategoryFactory.category();%0A%0A    final TestSubscriber%3CDiscoveryParams%3E startDiscoveryTest = new TestSubscriber%3C%3E();%0A    vm.outputs.startDiscovery().subscribe(startDiscoveryTest);%0A%0A    vm.inputs.categoryClick(null, category);%0A    startDiscoveryTest.assertValues(DiscoveryParams.builder().category(category).build());%0A  %7D
 %0A%7D%0A

Add startDiscovery test