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 property title = 'test' ;
the other two properties can have any value (of their correct type) as are not relevant for my testing scenario.
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");