Lets say I have this code below and I want to test someFunc() but I want to mock the doSomething() function? How can I do it in a test when the SomeClass is initialized only inside the someFunc() itself and not in the test?
class SomeClass {
constructor(element){
this.element = element
}
doSomething(element){
...
}
}
function someFunc() {
const newClass = new SomeClass()
newClass.doSomething() // I want this to get to the mocked function
}
I am using jest, please help!