A library I'm using is structured as
declare namespace foo {
function bar();
};
declare namespace foo.bar {
function baz();
};
So the two functions I need to mock are foo.bar() and foo.bar.baz().
To mock foo.bar() I was previously using
require('foo');
jest.mock('foo', () => ({
bar: () => mockedBar,
}));
Is there any way to mock foo.bar.baz()? I tried
jest.mock('foo.bar', () => ({
}));
But it's showing a message Cannot find module 'foo.bar' from 'functions.test.js'.