Skip to content

joacorandom/apigee-mocker-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apigee-mocker-context

Node utility for unit testing JS files created on Apigee.

Used for unit testing Apigee JS files.

Usage:

const { context } = require("apigee-mocker-context");

context.import({ "request.content": "test"});

const clonedContext = context.export();

Usage in Apigee

Use the following structure in your JS files so you will be able easily import them in Node. It's important to return context

const thisModule = env => {
    const context = env.context
    //TODO: Insert your code
    return context;
}
if (typeof exports !== 'undefined') exports.thisModule = thisModule;
if (typeof context !== 'undefined') thisModule({ context: context }) = thisModule;

About

Node utility for unit testing JS files created on Apigee.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors