Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
context("given instruction cards should be shown") {
var testObs: TestObserver<PSSMatchViewModel.Event, Never>!
beforeEach {
testObs = TestObserver<PSSMatchViewModel.Event, Never>()
viewModel.events.signal.observe(testObs.observer)
}
it("then swipe right card shown first") {
guard case .started(let context) = viewModel.state.value else {
XCTFail("Invalid state")
return
}
guard case .instructions(let rating) = context.cards.first else {
XCTFail("Invalid card")
return
}
expect(rating).to(equal(PSSMatchRating.interested))
}
context("when swiping past first") {
beforeEach {
viewModel.swipe(rating: .interested)
}
it("then app event is recorded") {
expect((appEventLogger as! AppEventLoggerFixture).lastEvent).to(beAppEventLoggable(PSSMatchAppEvent.swipedInstructions(instructionRating: .interested, actualRating: .interested)))
}
it("then swipe left shown next") {
guard case .started(let context) = viewModel.state.value else {
XCTFail("Invalid state")
return
}
guard case .instructions(let rating) = context.cards.first else {
XCTFail("Invalid card")
return
}
expect(rating).to(equal(PSSMatchRating.notInterested))
}
<snip/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment