azure-function-context-mock
v0.0.7
Published
Simple object to mock context in test when use Function App from Azure.
Downloads
2,884
Readme
azure-function-context-mock
Simple object to mock context in tests when use Function App from Azure.
Install
$ npm install --save-dev azure-function-context-mock
Usage
This example use Mocha but feel free to use your favorite test framework 😄
var context = require('azure-function-context-mock');
describe('my awsome tests', function () {
it('Yes, I have a context!', function (done) {
return myFunction(context)
.then(done);
});
});
Context Object
done
=> Promise
Returns a Promise
with a object with properties res
and bindings
to you can know when the function finishes in your test and ensure your output.
log
=> void
Execute console.log
to facilitate yours logs outside Azure.
bindings
=> Object
Just a empty object to you can set any binding and it's not undefined.
res
=> Object
Default res
object with status 200 and body string empty.
To more information about context
access Azure docs.