I am using ExpressJS and want to stub a function that responds with an HTTP response as a part of a router. In particular, it is a request to Amazon S3 that I am trying to stub.
app.get('/', (req, res, next) => {
s3.getSignedUrl('putObject', (err, url) => {
res.json({ url: url });
});
};
I am trying to stub getSignedUrl
using sinon
.
sinon.stubs(s3, 'getSignedUrl').returns({})
How can I properly stub this method? I don't want to make the request to S3 every time.
Aucun commentaire:
Enregistrer un commentaire