Jasmine\'s spyOn is good to change a method\'s behavior, but is there any way to change a value property (rather than a method) for an object? the code could be
spyOn
The right way to do this is with the spy on property, it will allow you to simulate a property on an object with an specific value.
const spy = spyOnProperty(myObj, 'valueA').and.returnValue(1); expect(myObj.valueA).toBe(1); expect(spy).toHaveBeenCalled();