mgw-mock-objects

1.1.0 • Public • Published

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);

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i mgw-mock-objects

    Weekly Downloads

    1

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • no9