Last active
August 29, 2015 13:57
-
-
Save ben-eb/9925808 to your computer and use it in GitHub Desktop.
Test for gulp clone.
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
var expect = require('chai').expect, | |
through = require('through2'), | |
gutil = require('gulp-util'), | |
clone = require('./'); | |
describe('gulp-clone', function() { | |
it('should clone files in the stream', function(done) { | |
var sourceStream = clone(), | |
cloneStream = clone(); | |
sourceStream.pipe(cloneStream); | |
sourceStream.on('data', function(data) { | |
expect(String(data.contents)).to.be.equal('source stream'); | |
expect(data.path).to.be.equal('file.js'); | |
}); | |
cloneStream.pipe(through.obj(function(file, enc, cb) { | |
file.contents = new Buffer('cloned stream'); | |
cb(null, file); | |
})) | |
cloneStream.on('data', function(data) { | |
expect(String(data.contents)).to.be.equal('cloned stream'); | |
expect(data.path).to.be.equal('file.js'); | |
}); | |
sourceStream.write(new gutil.File({ | |
path: 'file.js', | |
contents: new Buffer('source stream') | |
})); | |
sourceStream.on('finish', done); | |
sourceStream.end(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment