Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mock callback function jest

const bodyToAssertAgainst = {};
globals.request.post = jest.fn().mockImplementation((obj, cb) => {
    cb(null, bodyToAssertAgainst);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mock #callback #function #jest
ADD COMMENT
Topic
Name
5+6 =