Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

GLSea1979
Copy link

No description provided.

@@ -0,0 +1 @@
The lighting here can be a bit annoying.

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']);

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);

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.

fs.readFile(`${__dirname}/../data/three.txt`, function(err, data) {
if(err) throw err;
fileArray.push(data.toString('hex', 0, 8));
return callback(null, fileArray);

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.

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.

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) {

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.

});
});
describe('with a proper path for file one', function() {
it('should return the file for file one.txt', function() {

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants