Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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