Im working with an node handler in AWS lambda and i need to make another files with integration tests from that function, but i cant mock the transporter with sinon or mockery.
the handler function:
var nodemailer = require('nodemailer');
exports.handler = (event, context, callback) =>
{
var transporter=createTransporter();
}
function createTransporter() {
return nodemailer.createTransport({
service: "SMPT",
auth: {
user: "XXXX@XXX",
pass: "XXXX"
}
});
}
the purpose is to mock the function createTransporter() so that it doesnt send any email when it is called in javascript file test with mocha and expect.
Aucun commentaire:
Enregistrer un commentaire