hmock

0.4.3 • Public • Published

node-hmock

Very simple http request/response mocking for Node.JS

Build Status

Installation

npm install hmock

Usage

describe('#getSomething', function() {
  it('should make a GET request and get a response', function(done) {
    var expectedResponse = { 
      ok: true 
    };
 
    hmock.expect()
      .get('http://somewhere:3000/out/there')
      .respond()
      .withBody(expectedResponse);
 
    new MyClass().getSomething(function(err, result) {
      assert.equal(null, err);
      assert.deepEqual(expectedResponse, result);
 
      hmock.verify();
      
      done();
    });
  });
});

See test/http.tests.js and/or test/https.tests.js for more detailed examples.

License

            DO WHATEVER THE FUCK YOU WANT, PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
            0. You just DO WHATEVER THE FUCK YOU WANT.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.4.3
    1
    • latest

Version History

Package Sidebar

Install

npm i hmock

Weekly Downloads

1

Version

0.4.3

License

none

Last publish

Collaborators

  • timsavery