How do you test a function using Jest?

How do you test a function using Jest?

Jest has many built-in functions you can use to test your code, but for testing functions and methods, you need to rely on the fact that functions/methods are called and passed in as an argument. In order to do this, you will use the callback function that is passed into Jest as a parameter.