Conversation
| @@ -0,0 +1 @@ | |||
| Hello this is test two | |||
There was a problem hiding this comment.
You should make your sample test different for each file. You are only reading the beginning of each string and they all start the same here. So you won't know which order they are coming out.
|
|
||
| const fs = require('fs'); | ||
|
|
||
| const fileReader = require('./lib/file-reader.js') |
| fileReader(`${__dirname}/./data/two.txt`, function(err, data) { | ||
| if (err) throw err; | ||
| console.log('three:', data.toString('hex', 0, 8)); | ||
| }); |
There was a problem hiding this comment.
You should have one function that reads all three files 'in order'. Not a function that reads one file that you call three times. There is also no way with the way you are doing it here to guarantee that they come back in order.
| if (err) callback(err); | ||
| return callback(null, data.toString('hex',0,8)); | ||
| }); | ||
| }; |
There was a problem hiding this comment.
You are using the readFile function correctly to read a file. But you need to be reading all three files in order.
| done(); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
The way you set up your test here is similar to the way that you should set up your function in the file-reader.js file.
No description provided.