Skip to content

Commit

Permalink
Merge pull request #109 from silvolu/master
Browse files Browse the repository at this point in the history
refactor(storage): Use async in regression tests
  • Loading branch information
silvolu committed Aug 14, 2014
2 parents 6c364d8 + fea2551 commit 0064088
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions regression/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,18 @@ describe('storage', function() {
var fileConfig = { filename: pathToLogoFile };
var copyName = 'CloudLogoCopy';

// TODO(silvano): Use async.parallel.
bucket.write(fileName, fileConfig, function(err) {
assert.ifError(err);
bucket.copy(fileName, { name: copyName }, function() {
assert.ifError(err);
bucket.remove(copyName, function(err) {
assert.ifError(err);
bucket.remove(fileName, function(err) {
assert.ifError(err);
done();
});
});
async.parallel([
function(callback) {
bucket.remove(fileName, callback);
},
function(callback) {
bucket.remove(copyName, callback);
},
], done);
});
});
});
Expand Down Expand Up @@ -175,18 +175,12 @@ describe('storage', function() {
});

after(function(done) {
// TODO(silvano): Use Array.prototype.map to generate task array.
async.parallel([
function(callback) {
bucket.remove(filenames[0], callback);
},
function(callback) {
bucket.remove(filenames[1], callback);
},
function(callback) {
bucket.remove(filenames[2], callback);
}
], done);
async.parallel(
filenames.map(function(filename) {
return function(callback) {
bucket.remove(filename, callback);
};
}), done);
});
});
});

0 comments on commit 0064088

Please sign in to comment.