How to mock i18n in action.spec.js (jest)

I have imported
import i18n from ‘@/i18n.js’
In actions.js file.

I have used i18n.t in actions.js to get the translated text. It is working fine.

But I’m not able to mock i18n inside actions.spec.js

I’m doing this to mock it.

import i18n from ‘@/i18n.js’


And inside beforeAll I wrote
i18n.t = jest.fn(()=> object);

I have defined my object as well.

Can someone help me. Thanks in advance.

It shows an error in my i18n.js file

When I run unit testing on other files which are dependent on i18n they throw no error. Only this actions.spec.js is throwing the error