mgw-mock-objects
v1.1.0
Published
A mock object provider to help build tests for API Connect microgateway custom policies
Downloads
11
Readme
mgw-mock-objects
A mock object provider to help build tests for microgateway custom policies
This module is to creating custom javascript policies for the Strongloop Microgateway.
usage
Create a custom policy - See this end to end tutorial.
Then test it
$ npm install mgw-mock-objects -D
Example Test
// Create an instance of your custom policy
var Policy = require('../');
var p = Policy();
// create the mock objects
var mmo = require('mgw-mock-objects');
Set the properties that your policy expects
mmo.flow.proceed = function() {
//Assert your positive state
}
mmo.flow.fail = function() {
//Assert your negative state
}
// Invoke the policy
p(mmo.props, mmo.context, mmo.flow);