i have a script that defines 2 classes, and 1 gets instantiated from within the constructor of the other. how can i mock the nested constructor, so i can test the parent constructor?
export default class Foo {
// i want to test this constructor...
constructor() {
new Bar
}
}
export class Bar {
// but mock this constructor
constructor() {}
}
additionally, i am trying to spy on the Bar constructor, to assert that it has been called
i have tried several different approaches, but haven't been able to get the results i am looking for. i am new to the jest mocking library