Testing & QA Code Completion Easy +10 XP
Spy on Method
Complete to spy on the console.log method.
Testing & QAFill in the blank
const spy = jest.spyOn(___, 'log');Type the missing code
Show answer and explanation
Answer: console
jest.spyOn(object, methodName) creates a mock that wraps the original method, allowing you to track calls.
Hint: Which global object has the log method?
What this challenge tests
Code Completion in Testing & QA: jest, spying.