I have the following code that works:
jest.mock('../../src/providers', () => ({
...jest.requireActual('../../src/providers'),
getSettings: () => {
return { mandrill: { from: '', key: '', url: '' } }
},
}))
If I change to something like this:
const providersModule = '../../src/providers'
jest.mock(providersModule, () => ({
...jest.requireActual(providersModule),
getSettings: () => {
return { mandrill: { from: '', key: '', url: '' } }
},
}))
I got the error
ReferenceError: providersModule is not defined
My doubt is: How can I avoid repetion in this case?