Skip to content

Instantly share code, notes, and snippets.

@esilverberg
Created November 24, 2020 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esilverberg/86bb2fcbdb7ca1dbb7808e38268c75b5 to your computer and use it in GitHub Desktop.
Save esilverberg/86bb2fcbdb7ca1dbb7808e38268c75b5 to your computer and use it in GitHub Desktop.
@Nested
@DisplayName("given I flag someone")
inner class FlagSomeone {
lateinit var testObserver: TestObserver<MatchEvent>
lateinit var targetProfile: Profile
@BeforeEach
fun setup() {
testObserver = matchViewModel.events.test()
repeat(INSTRUCTION_CARDS_NUM) { matchViewModel.swipe(MatchRating.Interested) }
val matchState = matchViewModel.matchState.value as MatchState.Started
val matchItem = matchState.stack.items.lastElement() as MatchItem.ProfileCard
targetProfile = matchItem.profile
matchViewModel.flagButtonTapped()
}
@Test
fun `then sends flagged event`() {
testObserver.values().last() shouldBeInstanceOf MatchEvent.FlagProfile::class
(testObserver.values().last() as MatchEvent.FlagProfile).apply {
profile.shouldBeEqualTo(targetProfile)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment