-
Notifications
You must be signed in to change notification settings - Fork 17
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
a bunch of stuff, not really working #10
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1 @@ | |||
The lighting here can be a bit annoying. |
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.
Haha. Yeah, it can.
gulp.watch(['**/*.js', '!node_modules'], ['lint', 'test']); | ||
}); | ||
|
||
gulp.task('default', ['dev']); |
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.
Nice work including your gulp file.
const fileReader = require('./lib/file-reader.js'); | ||
|
||
|
||
fileReader('./data/one.txt', 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.
In your index file, you're calling fileReader on your first txt file.
With the way you structured your fileReader module, it will statically read file2 and file3 after...but it'd be best to make this more dynamic.
You can call this function with the three txt files, and dynamically have them be passed into the function in your file reader module in the other script.
lib/file-reader.js
Outdated
fs.readFile(`${__dirname}/../data/three.txt`, function(err, data) { | ||
if(err) throw err; | ||
fileArray.push(data.toString('hex', 0, 8)); | ||
return callback(null, fileArray); |
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.
Nice work passing in null for the callback's error argument when the function succeeds.
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.
And passing the data from your fileArray in when you finish as well.
test/file-test.js
Outdated
describe('File reading module', function() { | ||
describe('with an improper path', function() { | ||
it('should return with an error', function(done) { | ||
fileReader(`${__dirname}/../not-a-file.text`, function(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 test. Checks for an error with a bad filepath, and I'm sure this works.
test/file-test.js
Outdated
}); | ||
}); | ||
describe('with a proper path for file one', function() { | ||
it('should return the file for file one.txt', function() { |
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.
Need the test here to be able to call your function you created, pass in all 3 text files, and make sure to check if they have been read/stored in your fileArray in the correct order.
No description provided.