Mocking In Aws Lambda
I have a simple AWS Node.js Lambda, which I would like to test using mocks: //SimpleLambda.js var AWS = require('aws-sdk'); exports.handler = function(event, context) { var nam
Solution 1:
You need to export your getName
function so that it's accessible from test.js (and can be wrapped by your mocking library).
Something like this:
//SimpleLambda.jsvarAWS = require('aws-sdk');
exports.handler = function(event, context) {
var name = exports.getName();
context.succeed(name);
};
exports.getName = function (){
return'David';
}
Post a Comment for "Mocking In Aws Lambda"