Skip to content

Conversation

zcrumbo
Copy link

@zcrumbo zcrumbo commented Feb 16, 2017

No description provided.


fs.readFile(`${__dirname}/../data/${file1}`, function(err,data){
if (err) return callback(err);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need this white space here.



module.exports = function(file1, file2, file3, callback){

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is set up well. I like that you are passing in your file names as parameters.

module.exports = function(file1, file2, file3, callback){

fs.readFile(`${__dirname}/../data/${file1}`, function(err,data){
if (err) return callback(err);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job returning your error with the callback.

if (err) return callback(err);
var third = data.toString('hex').substring(0,8);
resultsArray.push(third);
return callback(null, resultsArray);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job pushing your data into an array and passing back the array at the end. This takes care of the asynchronous nature of the file reads.

expect(data[0]).to.equal(testData[0]);
expect(data[1]).to.equal(testData[1]);
expect(data[2]).to.equal(testData[2]);
done();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job here. This verify's that they are in the correct order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants