Skip to content

Commit

Permalink
Change handleSetup to setupFile
Browse files Browse the repository at this point in the history
This is to do all the work inside this function considering it was doing the
same thing anyway. And considering this is more than a callback, the
"handle" part isn't really something that describes the function anymore.
  • Loading branch information
sourrust committed Jun 18, 2015
1 parent 6d6e101 commit bdaa1a5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/utility.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var _ = require('lodash');
var fs = require('fs');
var path = require('path');

// Build a path relative to `test/`
Expand All @@ -20,11 +21,12 @@ exports.handleExpectedFile = _.curry(function(actual, done, err, expected) {
done();
}, 4);

exports.handleSetup = _.curry(
function(that, testHTML, done, err, expected) {
if(err) return done(err);
exports.setupFile = function(filename, encoding, that, testHTML, done) {
fs.readFile(filename, encoding, function(error, expected) {
if(error) return done(error);

that.expected = expected.trim();
that.blocks = _.map(testHTML, 'innerHTML');
done();
}, 5);
});
};

0 comments on commit bdaa1a5

Please sign in to comment.