Skip to content

Commit

Permalink
Merge pull request #7 from samccone/sjs/update-tests
Browse files Browse the repository at this point in the history
Sjs/update tests
  • Loading branch information
Raynos committed Apr 26, 2013
2 parents cbff67b + 64b0033 commit 30d201c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 36 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
@@ -1,3 +1,6 @@
language: node_js
node_js:
- 0.8
- "0.11"
- "0.10"
- "0.8"
- "0.6"
4 changes: 0 additions & 4 deletions Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -22,7 +22,7 @@ It is assumed that the two streams are connected to each other in some way.

## Tests

`make test`
`npm test`

## Contributors

Expand All @@ -33,4 +33,4 @@ It is assumed that the two streams are connected to each other in some way.

[1]: https://secure.travis-ci.org/Raynos/duplexer.png
[2]: http://travis-ci.org/Raynos/duplexer
[3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream
[3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -16,8 +16,8 @@
"url": "https://github.com/Raynos/duplexer/issues",
"email": "raynos2@gmail.com"
},
"dependencies": {},
"devDependencies": {
"tape": "0.3.3",
"through": "~0.1.4"
},
"licenses": [
Expand All @@ -27,6 +27,6 @@
}
],
"scripts": {
"test": "make test"
"test": "node test/test"
}
}
27 changes: 0 additions & 27 deletions test.js

This file was deleted.

31 changes: 31 additions & 0 deletions test/test.js
@@ -0,0 +1,31 @@
var duplex = require("../index")
, through = require("through")
, test = require("tape");

var readable = through()
, writable = through(write)
, written = 0
, data = 0;

var stream = duplex(writable, readable);

function write() {
written++
}

stream.on("data", ondata);

function ondata() {
data++
}

test("emit and write", function(t) {
t.plan(2);

stream.write();
readable.emit("data");

t.equal(written, 1, "should have written once");
t.equal(data, 1, "should have recived once");

});

0 comments on commit 30d201c

Please sign in to comment.