-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mock combinators #3014
Mock combinators #3014
Conversation
(FederatedRequest -> a) -> | ||
TestM b -> | ||
TestM (b, [FederatedRequest]) | ||
withTempMockFederator resp = withTempMockFederator' $ pure . encode . resp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that withTempMockFederator
is gone, how about renaming the remaining withTempMockFederator'
to withTempMockFederator
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not gone, it's the low-level function that is used by withTempMockFederator'
. We could consider condensing all of these into a single function that takes a Mock
parameter, but I would leave it for another PR.
8ca5fd6
to
0739f2b
Compare
0739f2b
to
ccfc113
Compare
ccfc113
to
beead90
Compare
This PR introduces a very simple system for specifying federation mocks in a composable way. This replaces previous attempts (in Galley) that were only adopted in a few tests. All instances of mocked federator are now using the new system.
The system itself is a super-minimalistic "web framework" of sorts, based on a
ReaderT FederatedRequest MaybeT
monad transformer. You useguard
to expect a certain request, and theAlternative
combinators to specify multiple responses based on various criteria.Checklist
changelog.d