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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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