Is it possible to mock some properties on an object using Jasmine
.spyOn()
? Basically, imagine I have a Page object that has title, deliveryTime and status that I want to mock it such that I just have to set the title propertytitle = 'test'
; the other two properties can have any value as are not relevant for my testing scenario. Why?
Some test fake code would be:
spyOnProperty(page, "title").and.returnValue(test);
This would be equivalent to C# / Moq as:
mock.Setup(foo => foo.Name).Returns("bar");