Skip to content

Commit

Permalink
fix streams implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianschmitt committed May 19, 2015
1 parent c8d0c96 commit bd654fd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var streamInterval = function(opts, fn, interval) {
this.stopped = true;
this.push(null);
};
outStream._read = function() {};
outStream._read = function(){};
scheduleInterval(Date.now());

return outStream;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"dependencies": {
"readable-stream": "^1.0.33"
"readable-stream": "^1.1.13"
},
"devDependencies": {
"chai": "^2.3.0",
Expand Down
40 changes: 18 additions & 22 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ describe('streamInterval', function() {
it('calls the stream factory at most every x milliseconds', function(done) {
var all = '';
var si = streamInterval(function() {
return new Readable({
read: function() {
this.push('hello');
this.push(null);
}
});
var s = new Readable();
s._read = function() {
this.push('hello');
this.push(null);
};
return s;
}, 100);

si.on('data', function(data) {
Expand All @@ -79,9 +79,8 @@ describe('streamInterval', function() {
var si = streamInterval(function() {
calls++;

var s = new Readable({
read: function(){}
});
var s = new Readable();
s._read = function(){};

setTimeout(function() {
s.push('hello');
Expand All @@ -107,13 +106,11 @@ describe('streamInterval', function() {
function threeObjects() {
var i = 0;
var si = streamInterval({ objectMode: true }, function() {
var s = new Readable({
objectMode: true,
read: function() {
this.push({ hello: 'world' });
this.push(null);
}
});
var s = new Readable({ objectMode: true });
s._read = function() {
this.push({ hello: 'world' });
this.push(null);
};
if (++i > 3) si.stop();
return s;
});
Expand All @@ -123,12 +120,11 @@ function threeObjects() {
function threeHellos() {
var i = 0;
var si = streamInterval(function() {
var s = new Readable({
read: function() {
this.push('hello');
this.push(null);
}
});
var s = new Readable();
s._read = function() {
this.push('hello');
this.push(null);
};
if (++i > 3) si.stop();
return s;
});
Expand Down

0 comments on commit bd654fd

Please sign in to comment.