Skip to content

Instantly share code, notes, and snippets.

@esilverberg
Created November 24, 2020 17:03
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/f5eece6f72a069b847d441f71b043b6c to your computer and use it in GitHub Desktop.
Save esilverberg/f5eece6f72a069b847d441f71b043b6c to your computer and use it in GitHub Desktop.
context("given I flag someone") {
var testObs: TestObserver<PSSMatchViewModel.Event, Never>!
var targetProfile: PSSProfile!
beforeEach {
testObs = TestObserver<PSSMatchViewModel.Event, Never>()
viewModel.events.signal.observe(testObs.observer)
for _ in 0..<instructionCardsNum {
viewModel.swipe(rating: PSSMatchRating.interested)
}
guard case .started(let context) = viewModel.state.value else {
XCTFail("Invalid state")
return
}
guard case .profile(let profile) = context.cards.first else {
XCTFail("Invalid state")
return
}
targetProfile = profile
viewModel.flagButtontapped()
}
it("then sends flagged event") {
guard case .flagProfile(let profile) = testObs.lastValue else {
return
}
expect(profile).to(equal(targetProfile))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment