source: frontend/node_modules/duplexer/test/index.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 525 bytes
RevLine 
[9af201e]1var through = require("through")
2var test = require("tape")
3
4var duplex = require("../index")
5
6var readable = through()
7var writable = through(write)
8var written = 0
9var data = 0
10
11var stream = duplex(writable, readable)
12
13function write() {
14 written++
15}
16
17stream.on("data", ondata)
18
19function ondata() {
20 data++
21}
22
23test("emit and write", function(t) {
24 t.plan(2)
25
26 stream.write()
27 readable.emit("data")
28
29 t.equal(written, 1, "should have written once")
30 t.equal(data, 1, "should have received once")
31})
Note: See TracBrowser for help on using the repository browser.