I have a method that inside I have a condition that I want to test. Something like:
myMethod():void {
let a:boolean;
a = this.myService.getValue();
if (a) {
doThis();
if (!a) {
doThat();
so in my it I did something like:
it("Should check if doThis called", () => {
spyOn(myService, "getValue").andReturn(true);
component.myMethod();
expect ...
});
But the condition wouldn't work and a would never get the "fake" value I mock with the spy
My question is if there's any way I can access / assign value to the local variable of myMethod() , a , or the only way is to make it global and then I can do in the it something like component.a =
Thanks.
awould never get the "fake" value I mock with the spy ?? Why is that ?