Marcos de prueba unitarios de JavaScript

// Run in console: npm install --save-dev jest

const myMockFunc = jest.fn(); 
console.log(myMockFunc()); 
// > undefined 
 
myMock.mockReturnValueOnce(false).mockReturnValue(true); 
 
console.log(myMock(), myMock(), myMock()); 
// > false, true, true
The Illusion Squid