Skip to content

Commit

Permalink
Add note to README regarding use of EventEmitter [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnny Estilles committed Jun 22, 2015
1 parent aaf60f2 commit f923e14
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Expand Up @@ -111,6 +111,28 @@ option | description | default value
`eventEmitter` | event emitter used by `response` object | `mockEventEmitter`
`writableStream` | writable stream used by `response` object | `mockWritableStream`

> NOTE: The out-of-the-box mock event emitter included with `node-mocks-http` is
not a functional event emitter and as such does not actually emit events. If you
wish to test your event handlers you will need to bring your own event emitter.

> Here's an example:
```js
var httpMocks = require('node-mocks-http');
var res = httpMocks.createResponse({
EventEmitter: require('events').EventEmitter;
});

// ...
it('should do something', funciton(done) {
res.on('end', function() {
assert.equal(...);
done();
});
});
// ...
```

## Design Decisions

We wanted some simple mocks without a large framework.
Expand Down

0 comments on commit f923e14

Please sign in to comment.