aws-lambda-mock-context
This library returns a mock context object that can be used to test lambda functions
Installation
npm install --save aws-lambda-mock-context
Usage
This library can be used with promises or callbacks.
var context = require('aws-lambda-mock-context');
describe('Lambda Test', function() {
it('Should call the succeed method', function(done) {
index.handler({hello: 'world'}, context());
context.Promise
.then(function() {
done();
})
.catch(function(err) {
done(err);
});
});
it('Should call the fail method', function(done) {
index.handler({hello: 'wrld'}, context(function(err, result) {
if(err) {
done();
}
else {
done(new Error('Fail not called');
}
));
});
});
Contributors
License
MIT © Sam Verschueren