-
Notifications
You must be signed in to change notification settings - Fork 15
Zachary Crumbo Assignment 3 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
re-added package.json and eslint, which mysteriously disappeared
|
||
fs.readFile(`${__dirname}/../data/${file1}`, function(err,data){ | ||
if (err) return callback(err); | ||
|
There was a problem hiding this comment.
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){ | ||
|
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
No description provided.