-
Notifications
You must be signed in to change notification settings - Fork 581
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
feat: add mock call history to access request configuration in test #4029
base: main
Are you sure you want to change the base?
Conversation
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.
Can you add testing for it?
Yes for sur. I just need times |
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.
Thanks for opening a PR! Can you please add a unit test?
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.
lgtm, small comment left
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.
LGTM, left minor comment and should be ready on my end
@mcollina can you take a bit of time to review back this PR ? it would be nice to have this change in the next release 🙏🏼 |
This relates to...
#4025
Rationale
Actually we are not able with MockAgent to assert request configuration.
Given this in mind, the only way we could do it is by wrapping our app http call in function, and then spy or mock that function with our favorite test framework. We can make assertions on parameters we passed through that function but, even with this possibility, we are not certain that undici did not make computation on inputs.
This PR is addressing this problematic : ensuring http calls are made with the expected low level configuration, as far as we can.
Changes
registerCallHistory
class method to MockScope instanceclearAllCallHistory
class method to MockAgent instancedisableCallHistory
class method to MockAgent instanceenableCallHistory
class method to MockAgent instanceenableCallHistory
MockAgent instantiation optionsMockAgent.close
is calledFeatures
Given this application :
After :
Before :
Bug Fixes
Breaking Changes and Deprecations
Status