Created
July 11, 2020 15:03
-
-
Save Sarthak2601/bc0ee968baf9567ccdebf1a2c3b5e708 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Mock | |
lateinit var mockOppiaEventLogsObserver: Observer<AsyncResult<OppiaEventLogs>> | |
@Captor | |
lateinit var oppiaEventLogResultCaptor: ArgumentCaptor<AsyncResult<OppiaEventLogs>> | |
private val eventLog = EventLog.newBuilder() | |
.setActionName(EventLog.EventAction.EVENT_ACTION_UNSPECIFIED) | |
.setContext( | |
EventLog.Context.newBuilder() | |
.setConceptCardContext( | |
EventLog.ConceptCardContext.newBuilder() | |
.setSkillId(TEST_SKILL_ID) | |
.build() | |
) | |
.build() | |
) | |
.setTimestamp(TEST_TIMESTAMP) | |
.setPriority(EventLog.Priority.ESSENTIAL) | |
.build() | |
@Before | |
@ExperimentalCoroutinesApi | |
fun setUp() { | |
setUpTestApplicationComponent() | |
} | |
@Test | |
@ExperimentalCoroutinesApi | |
@InternalCoroutinesApi | |
fun testStorageHelper_addEventLog_addsLogInStore(){ | |
logReportStorageHelper.addEventLog(eventLog) | |
logReportStorageHelper.getEventLogs().observeForever(mockOppiaEventLogsObserver) | |
verify(mockOppiaEventLogsObserver, atLeastOnce()).onChanged(oppiaEventLogResultCaptor.capture()) | |
val eventLogReport = oppiaEventLogResultCaptor.value.transform { it.getEventLog(0) }.getOrThrow() | |
assertThat(eventLogReport.priority).isEqualTo(EventLog.Priority.ESSENTIAL) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment