You have stubbed the function with one that does not return anything. FirstComponent.sayMyName = jest.fn();
To test the function, typically you can just do:
1 2 3 4 5 6 7 8 | // if static etc import { sayMyName } from '../foo/bar'; describe('bar', () => { it('should do what I like', () => { expect(sayMyName('orange')).toMatchSnapshot(); }); }) |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.