a bunch of stuff, not really working#10
a bunch of stuff, not really working#10GLSea1979 wants to merge 5 commits intocodefellows-javascript-401d13:masterfrom
Conversation
| @@ -0,0 +1 @@ | |||
| The lighting here can be a bit annoying. | |||
| gulp.watch(['**/*.js', '!node_modules'], ['lint', 'test']); | ||
| }); | ||
|
|
||
| gulp.task('default', ['dev']); |
| const fileReader = require('./lib/file-reader.js'); | ||
|
|
||
|
|
||
| fileReader('./data/one.txt', callback); |
There was a problem hiding this comment.
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.
| 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.
Nice work passing in null for the callback's error argument when the function succeeds.
There was a problem hiding this comment.
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.
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.
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.