Created
November 24, 2020 17:03
-
-
Save esilverberg/f5eece6f72a069b847d441f71b043b6c 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
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