Check for the ObjectProperties
of your method.
If the configurable
attribute is set to true
, you can try using Object.defineProperty():
Object.defineProperty(store['customerData'], 'isValid', {writable: true});
// And then put your code
store.customerData.isValid = jest.fn().mockResolvedValue(true);
If it's set to false
, I'm afraid I don't have any solution. I had a problem close to yours a few months ago (that I did not resolve) and I asked a question on SO, you can check what I tried, see if anything works for you: Override Object Property for unit testing purposes