Chain behaviours for the same command/payload
See original GitHub issueIt isn’t unusual in Jest to chain behaviours of a mock, for instance with several sequential calls to mockImplementationOnce
. This useful when you want to reproduce some specific behaviour, such as a call succeeding the first time but failing the second time.
I ran into this problem when I was refactoring my code to use this library. I was able to overcome it by refactoring my code a bit and giving each call/responses unique Ids.
I would consider this lower priority since in most cases you should be able to work around it. Still it might help to simplify test code.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:5 (2 by maintainers)
Top Results From Across the Web
ROP Chaining: Return Oriented Programming
The key thing to understand with ROP chaining is the stack layout. In our case, the payload that we send to the vulnerable...
Read more >Command-and-control servers: The puppet masters that ...
Command -and-control servers, also called C&C or C2, are used by attackers to maintain communications with compromised systems within a target network.
Read more >7 Stages of Cyber Kill Chain Supplementary Reading
What is delivery? Attacker sends malicious payload to the victim by means such as email, which is only one of the numerous intrusion...
Read more >Certificate Transparency MDM payload settings for Apple ...
Use the Certificate Transparency payload to control the behaviour of Certificate Transparency enforcement on iPhone, iPad, Mac or Apple TV ...
Read more >What is OS command injection, and how to prevent it?
This payload uses the nslookup command to cause a DNS lookup for the specified domain. The attacker can monitor for the specified lookup...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, I do this like:
It took a moment but is now released in v0.6.2 🎉
See the new
resolvesOnce()
,rejectsOnce()
, andcallsFakeOnce()
mock functions.