Skip to content

completed day 3 lab#9

Open
brials wants to merge 1 commit intocodefellows-javascript-401d13:masterfrom
brials:master
Open

completed day 3 lab#9
brials wants to merge 1 commit intocodefellows-javascript-401d13:masterfrom
brials:master

Conversation

@brials
Copy link
Copy Markdown

@brials brials commented Feb 16, 2017

No description provided.

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

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
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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)
Copy link
Copy Markdown

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){
Copy link
Copy Markdown

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);
Copy link
Copy Markdown

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){
Copy link
Copy Markdown

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');
Copy link
Copy Markdown

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