Open joshski opened 8 years ago
I'd like to do this in some rare cases:
pressPayNowButton().then(() =>
// the app is awaiting an ajax response from the payment server
// the payment server accepts the request but hangs until told how to respond
return paymentServer.respondToPost("/pay",
request => {
// the test is in control, so it can fail here
expectRequestToIncludeCorrectPaymentDetails(request)
return { status: 200 }
}
)
)
.then(() => verifyAppShowsPaymentSuccessful())
.then(() => paymentServer.verifyNoPendingRequests()) // paying only once is important
This is more of a "stub" router than a "mock" router. Not that I care about the name, but I was curious to know if you have you ruled out exposing a mock style API i.e. with
expect
andverify
semantics? If so, why?