is it possible to use Jasmine unit testing framework\'s spyon method upon a classes private methods?
The documentation gives this example but can this be flexivble for a
Let say sayHello(text: string)
is a private method. You can use the following code:
// Create a spy on it using "any"
spyOn(fakePerson, 'sayHello').and.callThrough();
// To access the private (or protected) method use [ ] operator:
expect(fakeperson['sayHello']).toHaveBeenCalledWith('your-params-to-sayhello');
any
.[]
operator.