Skip to content

Commit

Permalink
Update: Remove unused tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yocontra authored and phated committed Nov 28, 2017
1 parent fa958c0 commit 79ba924
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 88 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"strip-bom-stream": "^1.0.0",
"through2": "^2.0.0",
"vinyl": "^0.5.0",
"vinyl-filter-since": "^2.0.0"
"vinyl-filter-since": "^2.0.2"
},
"devDependencies": {
"buffer-equal": "^0.0.1",
Expand Down
95 changes: 8 additions & 87 deletions test/src.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ describe('source stream', function() {
}
});

it('should not explode on invalid glob (empty array)', function(done) {
var stream = vfs.src([]);
stream.once('data', done);
stream.once('end', function(){
it('should explode on invalid glob (empty array)', function(done) {
var stream;
try {
stream = vfs.src([]);
} catch (err) {
should.exist(err);
should.not.exist(stream);
done();
});
}
});

it('should error on file not existing', function(done) {
Expand Down Expand Up @@ -360,88 +363,6 @@ describe('source stream', function() {
stream1.pipe(stream2).pipe(bufferStream);
});

it('should pass files through (empty glob array in passthrough stream)', function(done) {
var expectedPaths = [
path.join(__dirname, './fixtures/test.coffee'),
path.join(__dirname, './fixtures/wow/suchempty')
];
var expectedContents = expectedPaths.map(function(path/* more args here so can't pass function directly */) {
return fs.readFileSync(path);
});

var onEnd = function(){
buffered.length.should.equal(2);
buffered.forEach(function(file) {
should.exist(file.stat);
file.isBuffer().should.equal(true);

expectedPaths.some(function(expectedPath) {
return file.path === expectedPath;
}).should.equal(true);

expectedContents.some(function(expectedContent) {
return bufEqual(file.contents, expectedContent);
}).should.equal(true);
});
done();
};

var stream1 = vfs.src(['./fixtures/*.coffee', './fixtures/wow/*'], {cwd: __dirname});
var stream2 = vfs.src([], {cwd: __dirname, passthrough: true});

var buffered = [];
bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd);
stream1.pipe(stream2).pipe(bufferStream);
});

it('should pass files through (empty glob array in source stream)', function(done) {
var expectedPaths = [
path.join(__dirname, './fixtures/test.coffee'),
path.join(__dirname, './fixtures/wow/suchempty')
];
var expectedContents = expectedPaths.map(function(path/* more args here so can't pass function directly */) {
return fs.readFileSync(path);
});

var onEnd = function(){
buffered.length.should.equal(2);
buffered.forEach(function(file) {
should.exist(file.stat);
file.isBuffer().should.equal(true);

expectedPaths.some(function(expectedPath) {
return file.path === expectedPath;
}).should.equal(true);

expectedContents.some(function(expectedContent) {
return bufEqual(file.contents, expectedContent);
}).should.equal(true);
});
done();
};

var stream1 = vfs.src([], {cwd: __dirname});
var stream2 = vfs.src(['./fixtures/*.coffee', './fixtures/wow/*'], {cwd: __dirname, passthrough: true});

var buffered = [];
bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd);
stream1.pipe(stream2).pipe(bufferStream);
});

it('should still end when passing through empty streams', function(done) {
var onEnd = function(){
buffered.length.should.equal(0);
done();
};

var stream1 = vfs.src([], {cwd: __dirname});
var stream2 = vfs.src([], {cwd: __dirname, passthrough: true});

var buffered = [];
bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd);
stream1.pipe(stream2).pipe(bufferStream);
});

it('should follow file symlinks', function(done) {
var expectedPath = path.join(__dirname, './fixtures/test.coffee');

Expand Down

0 comments on commit 79ba924

Please sign in to comment.