Skip to content

Commit

Permalink
No more data event
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed Feb 11, 2014
1 parent 88873dd commit 3406f09
Showing 1 changed file with 46 additions and 35 deletions.
81 changes: 46 additions & 35 deletions tests/index.mocha.js
Expand Up @@ -25,15 +25,18 @@ describe('gulp-streamify', function() {
})
;

stream.on('data', function(newFile){
assert(newFile);
assert.equal(newFile.cwd, "/home/nfroidure/");
assert.equal(newFile.base, "/home/nfroidure/test");
assert.equal(newFile.contents, null);
if(++n == 1) {
assert.equal(newFile.path, "/home/nfroidure/test/file.js");
} else {
assert.equal(newFile.path, "/home/nfroidure/test/file2.js");
stream.on('readable', function() {
var newFile;
while(newFile = stream.read()) {
assert(newFile);
assert.equal(newFile.cwd, "/home/nfroidure/");
assert.equal(newFile.base, "/home/nfroidure/test");
assert.equal(newFile.contents, null);
if(++n == 1) {
assert.equal(newFile.path, "/home/nfroidure/test/file.js");
} else {
assert.equal(newFile.path, "/home/nfroidure/test/file2.js");
}
}
});

Expand Down Expand Up @@ -78,21 +81,25 @@ describe('gulp-streamify', function() {
})
;

stream.on('data', function(newFile){
assert(newFile);
assert.equal(newFile.cwd, "/home/nfroidure/");
assert.equal(newFile.base, "/home/nfroidure/test");
assert(newFile.contents instanceof Stream);
if(++n == 1) {
assert.equal(newFile.path, "/home/nfroidure/test/file.js");
newFile.contents.pipe(es.wait(function(err, data) {
assert.equal(data, 'plipplaptest');
}));
} else {
assert.equal(newFile.path, "/home/nfroidure/test/file2.js");
newFile.contents.pipe(es.wait(function(err, data) {
assert.equal(data, 'ploppluptest');
}));

stream.on('readable', function() {
var newFile;
while(newFile = stream.read()) {
assert(newFile);
assert.equal(newFile.cwd, "/home/nfroidure/");
assert.equal(newFile.base, "/home/nfroidure/test");
assert(newFile.contents instanceof Stream);
if(++n == 1) {
assert.equal(newFile.path, "/home/nfroidure/test/file.js");
newFile.contents.pipe(es.wait(function(err, data) {
assert.equal(data, 'plipplaptest');
}));
} else {
assert.equal(newFile.path, "/home/nfroidure/test/file2.js");
newFile.contents.pipe(es.wait(function(err, data) {
assert.equal(data, 'ploppluptest');
}));
}
}
});

Expand Down Expand Up @@ -150,17 +157,21 @@ describe('gulp-streamify', function() {
})
;

stream.on('data', function(newFile){
assert(newFile);
assert.equal(newFile.cwd, "/home/nfroidure/");
assert.equal(newFile.base, "/home/nfroidure/test");
assert(newFile.contents instanceof Buffer);
if(++n == 1) {
assert.equal(newFile.path, "/home/nfroidure/test/file.js");
assert.equal(newFile.contents.toString(), 'plipplaptest');
} else {
assert.equal(newFile.path, "/home/nfroidure/test/file2.js");
assert.equal(newFile.contents.toString(), 'plippluptest');

stream.on('readable', function() {
var newFile;
while(newFile = stream.read()) {
assert(newFile);
assert.equal(newFile.cwd, "/home/nfroidure/");
assert.equal(newFile.base, "/home/nfroidure/test");
assert(newFile.contents instanceof Buffer);
if(++n == 1) {
assert.equal(newFile.path, "/home/nfroidure/test/file.js");
assert.equal(newFile.contents.toString(), 'plipplaptest');
} else {
assert.equal(newFile.path, "/home/nfroidure/test/file2.js");
assert.equal(newFile.contents.toString(), 'plippluptest');
}
}
});

Expand Down

0 comments on commit 3406f09

Please sign in to comment.