Created
November 24, 2020 17:04
-
-
Save esilverberg/86bb2fcbdb7ca1dbb7808e38268c75b5 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
@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