In Jest, to isolate a module from its dependencies for more focused unit testing, you would use ______.
- mock
- stub
- spy
- inject
In Jest, you can use the mock function to isolate a module from its dependencies. This allows you to replace the real dependencies with mock implementations for focused unit testing.
Loading...
Related Quiz
- What is the primary difference between OAuth 1.0 and OAuth 2.0?
- Which of the following responses to a preflight request will allow a browser to make a cross-origin call to upload a file?
- You are tasked with developing a real-time chat application where low latency and high availability are critical. Which type of database would be the most suitable, and what considerations should you have in mind regarding data consistency and partitioning?
- Which of the following is a suitable method to prevent variable leakage in the global scope?
- You are developing an e-commerce application where multiple API calls are made to fetch product details. How can you efficiently handle multiple Promises to ensure that even if one fails, others continue execution?