Skip to content

completed day 3 lab #9

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brials
Copy link

@brials brials commented Feb 16, 2017

No description provided.

"indent": [ "error", 2 ],
"quotes": [ "error", "single" ],
"semi": ["error", "always"],
"linebreak-style": [ "error", "unix" ]

Choose a reason for hiding this comment

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

No comma dangle. :p Boo

@@ -0,0 +1,117 @@
# Created by https://www.gitignore.io/api/node,vim,osx,macos,linux

*node_modules

Choose a reason for hiding this comment

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

Nice work ignoring node modules

@@ -0,0 +1 @@
Brian is a pretty cool teacher

Choose a reason for hiding this comment

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

I'm sure he would appreciate this text file.

@@ -0,0 +1 @@
Hopefully I get this right

Choose a reason for hiding this comment

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

Seems right to me!

@@ -0,0 +1 @@
Too bad he makes me text this in order

Choose a reason for hiding this comment

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

Yeah, what a jerk. :p

fs.readFile(file1, function(err, data){
if(err) return callback(err);
var eightHexes = data.toString('hex')
.match(/.{1,2}/g)

Choose a reason for hiding this comment

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

Nice regex. :)

if(err) return callback(err);
var eightHexes = data.toString('hex')
.match(/.{1,2}/g)
.filter(function(ele, index){

Choose a reason for hiding this comment

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

Nice use of a higher order array method.

}).join('');
resArr.push(eightHexes);
console.log(eightHexes);
return callback(null, resArr);

Choose a reason for hiding this comment

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

Nice use of the callback here, though I don't see you calling it in your initial function call in your other page?

describe('File Reader Module', function(){
describe('with an improper set of filepaths', function(){
it('should return an error', function(done){
fileReader('bad/path1', 'bad/path2', 'bad/path3', function(err){

Choose a reason for hiding this comment

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

Good work with the bad file paths for the test. The test should fail and throw an error immediately when it hits the first bad file, though.

it('should return all of the correct data', function(done){
fileReader(`${__dirname}/../data/one.txt`, `${__dirname}/../data/two.txt`, `${__dirname}/../data/three.txt`, function(err, data){
expect(data.length).to.equal(3);
expect(data[0]).to.equal('427269616e206973');

Choose a reason for hiding this comment

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

Great test. Nice work checking the actual returned hex values, as well as the length of the data array being returned.

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