I have a React component which calls an external API. I'm try to unit test this component, but I didn't understand how I can mock the function with jest and "fake" the result.
Component:
import { getWeather } from '../../service/WeatherService'
import {useState, useEffect} from 'react'
export default function Weather() {
...
useEffect(() => {
getWeather().then((res) => { // function which calls the external API
...
}