Setup
Scenario
There's a file with a bunch of controllers and each one instances a class from other file, every time that it receives a response from an API.
Everything is in the same folder, even the test, it's a bad architecture, not the point here.
The objective of the tests is to test only the controllers, not the response class, which is called, ServiceResponseClass.
Running
The first test runs successfully, without any error. But it doesn't even stops on the breakpoint inside the constructor, which is very odd, maybe not much relevant.
From the second test and beyond the tests fails and the received values are:
[TypeError: ServiceResponse_d_1.ServiceResponseClass is not a constructor]
Attempts
I tried to use jest.mock pointing to jest.requireActual and it didn't worked, even inside beforeEach, as described here.
It isn't a import problem, as described here.
I've tried to mock the class and its methods as described here and here, but I've got stuck mocking the returns on each test.
Reviewing
I want to test only the controllers, without needing to mock the class instances inside of it. Or, if it's the only option, how should I do it?
Solutions, readings suggestions, links, whatever you give me is something welcome.