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 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