[Pkg-javascript-commits] [node-mocks-http] 250/296: Add note to README regarding use of EventEmitter [skip ci]
Thorsten Alteholz
alteholz at moszumanska.debian.org
Mon Feb 8 18:13:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
alteholz pushed a commit to branch master
in repository node-mocks-http.
commit f923e144eafc5d4a134377832816ba1b31eebc63
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date: Mon Jun 22 08:25:11 2015 +0800
Add note to README regarding use of EventEmitter [skip ci]
---
README.md | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/README.md b/README.md
index 9122c72..fc6c2b1 100644
--- a/README.md
+++ b/README.md
@@ -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.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git
More information about the Pkg-javascript-commits
mailing list