diff --git a/.travis.yml b/.travis.yml index c2ba3f9..ed05f88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ language: node_js node_js: - - 0.8 \ No newline at end of file + - "0.11" + - "0.10" + - "0.8" + - "0.6" diff --git a/Makefile b/Makefile deleted file mode 100644 index 1f8985d..0000000 --- a/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -test: - node test.js - -.PHONY: test \ No newline at end of file diff --git a/README.md b/README.md index a24cecb..dbaeea3 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 \ No newline at end of file + [3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream diff --git a/package.json b/package.json index 4a2636b..4a5b236 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -27,6 +27,6 @@ } ], "scripts": { - "test": "make test" + "test": "node test/test" } } diff --git a/test.js b/test.js deleted file mode 100644 index e06a864..0000000 --- a/test.js +++ /dev/null @@ -1,27 +0,0 @@ -var duplex = require("./index") - , assert = require("assert") - , through = require("through") - -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++ -} - -stream.write() -readable.emit("data") - -assert.equal(written, 1) -assert.equal(data, 1) -console.log("DONE") \ No newline at end of file diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..2872143 --- /dev/null +++ b/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"); + +});