doppleganger

0.0.1 • Public • Published

For e.g., to mock GET http://abc.com/:id?api_key=XYZ

var dopple = require('doppleganger');
var doppleURL = "http:/abc.com";
 
var done;
 
var ender = function(err, res) {
    //the headers
    console.log(res.headers);
    //the body
    console.log(res.body);
 
}
 
dopple.base(doppleURL)
    .get( { query: { 'api_key': 'xyz' }, params: { id: '.*' } } )
    .respond( { header: { code: 200 }, body: require('./fixture1.json') } );
    .end(cb);

1 mock a URL namespace with http

2 assert presence of URI parameters

3 fail if the mock isn't called in the duration of the test

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i doppleganger

      Weekly Downloads

      1

      Version

      0.0.1

      License

      ISC

      Last publish

      Collaborators

      • nicholasf
      • cgiffard
      • indieisaconcept