request-moq
v1.0.1
Published
Mock object for use instead http request in unit tests.
Downloads
2
Readme
request-moq
Mock object for use instead http request in unit tests.
You can add it to your project with npm:
npm install --save-dev request-moq
Quickstart guide:
var mRequest = require('request-moq');
var options = {
method: 'GET',
url: 'http://localhost',
headers: [ { Accept: 'application-json'} ]
};
mRequest.expect(options).respond({statusCode: 201});
mRequest(options, function(error, response, body){
expect(error).toBeUndefined();
expect(response.statusCode).toEqual(201);
expect(body).toBeUndefined();
});
Other usage examples you can find at spec/RequestMoqSpec.js.