One way I found to handle it: to clear mock function after each test:
To add to Sum.test.js:
afterEach(() => {
local.getData.mockClear();
});
If you’d like to clear all mock functions after each test, use clearAllMocks
afterEach(() => {
jest.clearAllMocks();
});