simple-mock
simple-mock copied to clipboard
Getter/setter suport
Is there any plans to support getters and setters mocking as well? Right now it doesn't seem to work at all.
src:
class Device {
static model = 'Nexus';
static get isIphoneX(){
return this.model === 'iPhone X';
}
}
test:
const mock1 = simple.mock(Device, 'isIphoneX', true);
console.log(Device.isIphoneX); // => false
console.log(mock1.callCount); // => undefined
const mock2 = simple.mock(Device, 'isIphoneX').returnWith(true);
console.log(Device.isIphoneX); // => false
console.log(mock2.callCount); // => undefined
Thank you!
This would be a good addition, especially since getters and setters seems to be used more frequently with ES6 class
syntax.