Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from samccone/sjs/update-tests
Sjs/update tests
- Loading branch information
Showing
6 changed files
with
39 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- 0.8 | ||
- "0.11" | ||
- "0.10" | ||
- "0.8" | ||
- "0.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
|
||
}); |