completed day 3 lab#9
Open
brials wants to merge 1 commit intocodefellows-javascript-401d13:masterfrom
Open
Conversation
broxsonl
reviewed
Feb 16, 2017
| "indent": [ "error", 2 ], | ||
| "quotes": [ "error", "single" ], | ||
| "semi": ["error", "always"], | ||
| "linebreak-style": [ "error", "unix" ] |
| @@ -0,0 +1,117 @@ | |||
| # Created by https://www.gitignore.io/api/node,vim,osx,macos,linux | |||
|
|
|||
| *node_modules | |||
| @@ -0,0 +1 @@ | |||
| Brian is a pretty cool teacher | |||
There was a problem hiding this comment.
I'm sure he would appreciate this text file.
| @@ -0,0 +1 @@ | |||
| Hopefully I get this right | |||
| @@ -0,0 +1 @@ | |||
| Too bad he makes me text this in order | |||
| fs.readFile(file1, function(err, data){ | ||
| if(err) return callback(err); | ||
| var eightHexes = data.toString('hex') | ||
| .match(/.{1,2}/g) |
| if(err) return callback(err); | ||
| var eightHexes = data.toString('hex') | ||
| .match(/.{1,2}/g) | ||
| .filter(function(ele, index){ |
There was a problem hiding this comment.
Nice use of a higher order array method.
| }).join(''); | ||
| resArr.push(eightHexes); | ||
| console.log(eightHexes); | ||
| return callback(null, resArr); |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
Great test. Nice work checking the actual returned hex values, as well as the length of the data array being returned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.