seneca-stub
A utility for stubbing seneca.js patterns using Sinon.JS
This is based on Denis Luchkin-Zhou's stub utility from seneca-as-promised
Install
npm install seneca-stub
Getting Started
const Seneca = ;Seneca;
Return static data
const stub = Seneca;await Seneca; // { foo: 'bar' } stubdata; // { role: 'test', cmd: 'stub', herp: 'derp' }
Use custom function
const stub = Seneca;await Seneca; // { greeting: 'hello john' } stubdata; // { role: 'test', cmd: 'stub', name: 'john' }
If value provided to Seneca.stub
is an Error
, then it will be thrown instead
of being returned.