I have the following code:
const newImage = new Image(...);
newImage.save().then(image => {...})
Is there a way to stub the save method for Image to resolve the object which called it? ie. I want image in the then clause to just be the same as newImage
Something like sinon.stub(Image.prototype, 'save').resolves(theCallingObject);
Is this possible? Any help is appreciated. Thanks!
Aucun commentaire:
Enregistrer un commentaire