ssbc/muxrpc-mock

Name: muxrpc-mock

Owner: Secure Scuttlebutt Consortium

Description: Generate mock APIs from muxrpc manifests

Created: 2016-04-03 03:53:45.0

Updated: 2016-04-03 04:35:19.0

Pushed: 2016-04-03 04:32:46.0

Homepage: null

Size: 3

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

MuxRPC Mock

Generate mock APIs from muxrpc manifests. Useful for generating test suites.

muxmock = require('muxrpc-mock')

ypical muxrpc manifest:
manifest = {
ync: 'async',
urce: 'source',
nk: 'sink',
plex: 'duplex'


api = muxmock(manifest)
pi now has all methods defined, but each do nothing

You can specify functions to be called when the api methods are hit:

api = muxmock(manifest, {
Async: function (method, arguments) {
// async method called
// `method` is the name of the function called
// `arguments` is the parameters of the call

Source: function (method, arguments) {
// source or duplex method called
// `method` is the name of the function called
// `arguments` is the parameters of the call

Sink: function (method, data) {
// sink or duplex method called
// `method` is the name of the function called
// `data` is the collected data from the pull stream



This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.