114
rated 0 times
[
115]
[
1]
/ answers: 1 / hits: 88460
/ 7 Years ago, sat, april 29, 2017, 12:00:00
In Sinon I can do the following:
var myObj = {
prop: 'foo'
};
sinon.stub(myObj, 'prop').get(function getterFn() {
return 'bar';
});
myObj.prop; // 'bar'
But how can I do the same with Jest?
I can't just overwrite the function with something like jest.fn()
, because it won't replace the getter
can't set the value of get
More From » reactjs