I am trying to write a unit test for my angular service. The service makes use of a static method from inside a model class.
I used jest to mock the class like that:
jest.mock('modelName', () => ({
...jest.requireActual('modelName'), // This will preserve other exports
RunTreeNodeModel: {
fromDTO: jest.fn(),
}
}));
However, when I debug the test, it turns out that jest cannot find it and says ReferenceError: ‘RunTreeNodeModel’ is not defined in jest.
I made sure to import it RunTreeNodeModel the test class. I have another test class in the same package that makes use of RunTreeNodeModel, and it runs just fine. It is imported and mocked in the same way, so I don’t understand what the issue could be.
Anyone has any idea of where to look?