request-moq

1.0.1 • Public • Published

request-moq Build status

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.

Readme

Keywords

Package Sidebar

Install

npm i request-moq

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • egorov