not quite working yet#12
Conversation
| "indent": [ "error", 2 ], | ||
| "quotes": [ "error", "single" ], | ||
| "semi": ["error", "always"], | ||
| "linebreak-style": [ "error", "windows" ] |
| @@ -0,0 +1,117 @@ | |||
| # Created by https://www.gitignore.io/api/node,vim,osx,macos,linux | |||
|
|
|||
| *node_modules | |||
|
|
||
| const fs = require('fs'); | ||
|
|
||
| const textReader = module.exports = function(file, callback) { |
There was a problem hiding this comment.
Good function here. This is the right structure, but it doesn't ensure that this will run asynchronously.
|
|
||
| const textReader = require('../lib/text-reader.js'); | ||
|
|
||
| textReader('./data/one.txt', function(err, data) { |
| @@ -0,0 +1,23 @@ | |||
| 'use strict'; | |||
|
|
|||
| var buffs = []; | |||
There was a problem hiding this comment.
Nice work storing your results in your array...but where is it going? I see you pushing all of the data from your function calls into this array, but you're not passing it back to the function you're calling.
|
|
||
| const textReader = module.exports = function(file, callback) { | ||
| fs.readFile(file, function(err, data) { | ||
| if (err) return callback(err); |
There was a problem hiding this comment.
Nice work returning the callback with an error.
| const expect = require('chai').expect; | ||
| const textReader = require('../lib/text-reader.js'); | ||
| const buffs = require('buffs'); | ||
|
|
There was a problem hiding this comment.
Your tests test that each of your files is being read, but it is not testing if they are being read asynchronously, and if the information is coming back in the right order.
| }); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
You'll need a test that can read all three text files in the same function, do it IN ORDER asynchronously, and return the information in the proper order. You should test for that order being correct.
No description provided.