Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript unit testing frameworks

// 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
Source by www.testim.io #
 
PREVIOUS NEXT
Tagged: #javascript #unit #testing #frameworks
ADD COMMENT
Topic
Name
8+8 =