'Jest how to test function is called from $( document ).ready

Function which is called from $.ready is reported as not tested in code coverage .I need to write test case to cover function is getting called when document is ready.

$(document).ready(function() {
    fetchUser() // this line is reported as not tested in code coverage
});

Basically I need to mock function and I need to assert mock function is invoked when document is ready



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source