I want to test a function that fetch something from server, it looks like this :
import React, { useEffect } from 'react';
function Component1() {
    useEffect(() => {
        fetchSomeData();
    }, [])
    const fetchSomeData = async () =>{
        console.log('fetchSomeData')
       
    }
    return <div>Component1</div>;
}
export default Component1;
and test file:
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { act } from 'react-dom/test-utils';
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Component1 from './Component1.js';
Enzyme.configure({ adapter: new Adapter() });
describe('Name of the group', () => {
    it('should ', () => {
        const wrapper = shallow(<Component1 />);
        expect(wrapper.exists());
        
    });
});
[![picture1][1]][1]
but the test is not covered 'fetchSomeData', any one knows why?
I referred this answer : test restapi inside useeffect in jest try to mock a fn and call it , but I got this:

