I have a dependency that is a singleton class like so:
// dependency.js
class Dependency {
foo() { ... }
}
export default new Dependency();
I'm trying to mock this class with Jest but since its a singleton I'm not sure how to mock it. I tried this:
jest.mock('../Dependency', () => {
return { foo: jest.fn() };
});
But that didn't work.