azure-function-context-mock

0.0.7 • Public • Published

npm version Build Status

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.

Readme

Keywords

none

Package Sidebar

Install

npm i azure-function-context-mock

Weekly Downloads

542

Version

0.0.7

License

MIT

Last publish

Collaborators

  • limafelipe