1.0.0 • Published 9 years ago

mocksy v1.0.0

Weekly downloads
4
License
BSD
Repository
github
Last release
9 years ago

mocksy

Mock Node.js http server for testing. Regurgitates the request object.

Install

npm install mocksy --save-dev

Usage

var Mocksy = require('mocksy');
var mocksy = new Mocksy({port: 4321});

// In your test runner

describe('Some http endpoint', function () {
  beforeEach(function (done) {
    mocksy.start(done);
  });
  
  afterEach(function (done) {
    mocksy.stop(done);
  });
  
  it('should just work, right?', function (done) {
    // Do your http requests
  });
});

API

new Mocksy({port: 1337});

Create and instance of the mocksy mock server. Optionally pass in the following options

  • port - server port. defaults to 1137 if no port is provided

start(callback)

Starts the mocksy mock server. Takes a callback as the only argument.

stop(callback)

Stops the mocksy mock server. Takes a callback as the only argument.

Run Tests

npm test
1.0.0

9 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

11 years ago

0.1.3

11 years ago