Skip to content

Commit

Permalink
remove light insight (#1913)
Browse files Browse the repository at this point in the history
* remove light insight

* remove test
  • Loading branch information
jykfan authored Mar 20, 2017
1 parent fd6fea6 commit 3963be0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,7 @@ public Optional<InsightCard.Category> selectRandomOldInsightsToGenerate(final Lo
return Optional.of(InsightCard.Category.TEMPERATURE);

case 13:
if (!InsightsLastSeen.checkQualifiedInsight(recentCategories, InsightCard.Category.LIGHT, LAST_TWO_WEEKS)) {
return Optional.absent();
}
return Optional.of(InsightCard.Category.LIGHT);
return Optional.absent(); //Previously scheduled for light
case 18:
if (!featureFlipper.userFeatureActive(FeatureFlipper.INSIGHTS_CAFFEINE, accountId, Collections.EMPTY_LIST)) {
return Optional.absent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,36 +460,6 @@ public void test_generateGeneralInsights_8() {
assertThat(insightProcessor.generateGeneralInsights(FAKE_ACCOUNT_ID, FAKE_DEVICE_ACCOUNT_PAIR, deviceDataDAODynamoDB, recentCategories, FAKE_DATE_13, mockFeatureFlipper).get(), isIn(marketingInsightPool));
}

@Test
public void test_generateGeneralInsights_9() {

final RolloutClient mockFeatureFlipper = featureFlipOn();
final InsightProcessor insightProcessor = setUp();
final InsightProcessor spyInsightProcessor = Mockito.spy(insightProcessor);

//actually simulating recent categories
final Map<InsightCard.Category, DateTime> recentCategories = new HashMap<>();
recentCategories.put(InsightCard.Category.TEMPERATURE, DateTime.now(DateTimeZone.UTC));

spyInsightProcessor.generateGeneralInsights(FAKE_ACCOUNT_ID, FAKE_DEVICE_ACCOUNT_PAIR, deviceDataDAODynamoDB, recentCategories, FAKE_DATE_13, mockFeatureFlipper);

//TEST - Look for weekly Insight, do not try to generate b/c wrong date
Mockito.verify(spyInsightProcessor).selectWeeklyInsightsToGenerate(recentCategories, FAKE_DATE_13.plusMillis(OFFSET_MILLIS));
Mockito.verify(spyInsightProcessor, Mockito.never()).generateInsightsByCategory(FAKE_ACCOUNT_ID, FAKE_DEVICE_ACCOUNT_PAIR, deviceDataDAODynamoDB, InsightCard.Category.WAKE_VARIANCE, mockFeatureFlipper);

//look for high priority Insight - get nothing

//look for random old Insight, try to generate humidity
Mockito.verify(spyInsightProcessor).selectRandomOldInsightsToGenerate(FAKE_ACCOUNT_ID, recentCategories, FAKE_DATE_13.plusMillis(OFFSET_MILLIS), mockFeatureFlipper);
Mockito.verify(spyInsightProcessor).generateInsightsByCategory(FAKE_ACCOUNT_ID, FAKE_DEVICE_ACCOUNT_PAIR, deviceDataDAODynamoDB, InsightCard.Category.LIGHT, mockFeatureFlipper);
Mockito.verify(spyInsightProcessor, Mockito.never()).generateInsightsByCategory(FAKE_ACCOUNT_ID, FAKE_DEVICE_ACCOUNT_PAIR, deviceDataDAODynamoDB, InsightCard.Category.TEMPERATURE, mockFeatureFlipper);
Mockito.verify(spyInsightProcessor, Mockito.never()).generateInsightsByCategory(FAKE_ACCOUNT_ID, FAKE_DEVICE_ACCOUNT_PAIR, deviceDataDAODynamoDB, InsightCard.Category.SLEEP_QUALITY, mockFeatureFlipper);
Mockito.verify(spyInsightProcessor, Mockito.never()).generateInsightsByCategory(FAKE_ACCOUNT_ID, FAKE_DEVICE_ACCOUNT_PAIR, deviceDataDAODynamoDB, InsightCard.Category.BED_LIGHT_DURATION, mockFeatureFlipper);

//Marketing Insight is not generated b/c already made humidity - can't spy on private random, so do assert
assertThat(marketingInsightPool.contains(insightProcessor.generateGeneralInsights(FAKE_ACCOUNT_ID, FAKE_DEVICE_ACCOUNT_PAIR, deviceDataDAODynamoDB, recentCategories, FAKE_DATE_13, mockFeatureFlipper).get()), is(Boolean.FALSE));
}


@Test
public void test_selectMarketingInsightToGenerate_0() {
Expand Down

0 comments on commit 3963be0

Please sign in to comment.