-
Notifications
You must be signed in to change notification settings - Fork 154
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
fixes issue #667 #678
fixes issue #667 #678
Conversation
…nst/let AND strict mode
…nst/let AND strict mode
Codecov Report
@@ Coverage Diff @@
## master #678 +/- ##
==========================================
- Coverage 86.71% 86.63% -0.08%
==========================================
Files 16 16
Lines 1746 1736 -10
==========================================
- Hits 1514 1504 -10
Misses 232 232
Continue to review full report at Codecov.
|
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.
many changes can be const instead of let, review the inline comments
tests/spec/fs.write.spec.js
Outdated
|
||
describe('fs.write', function() { | ||
beforeEach(util.setup); | ||
afterEach(util.cleanup); | ||
|
||
it('should be a function', function() { | ||
var fs = util.fs(); | ||
let fs = util.fs(); |
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.
fs can be const as it isnt changed in this scope
let fs = util.fs(); | |
const fs = util.fs(); |
tests/spec/fs.write.spec.js
Outdated
var fs = util.fs(); | ||
var fn = () => fs.writeFile(undefined, 'data'); | ||
let fs = util.fs(); | ||
let fn = () => fs.writeFile(undefined, 'data'); |
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.
fn can be const as well
let fn = () => fs.writeFile(undefined, 'data'); | |
const fn = () => fs.writeFile(undefined, 'data'); |
tests/spec/fs.write.spec.js
Outdated
var fs = util.fs(); | ||
var buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); | ||
let fs = util.fs(); | ||
let buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); |
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.
buffer is just passed into a function it can be const
let buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); | |
constt buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); |
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.
I agree with the other review comments here, please make the updates.
Also, please back-out your changes to package-lock.json
:
git checkout master package-lock-json
Then you can commit and push that to this branch, and it won't include this file. It's not related to your changes, so doesn't belong in this PR.
tests/spec/fs.write.spec.js
Outdated
expect(fs.write).to.be.a('function'); | ||
}); | ||
|
||
it('should error if file path is undefined', function() { | ||
var fs = util.fs(); | ||
var fn = () => fs.writeFile(undefined, 'data'); | ||
let fs = util.fs(); |
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.
const
here, since fs
won't change
tests/spec/fs.write.spec.js
Outdated
expect(fn).to.throw(); | ||
}); | ||
|
||
it('should write data to a file', function(done) { | ||
var fs = util.fs(); | ||
var buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); | ||
let fs = util.fs(); |
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.
const
here too
tests/spec/fs.write.spec.js
Outdated
var fs = util.fs(); | ||
var buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); | ||
var _result = 0; | ||
let fs = util.fs(); |
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 here, const
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.
A couple of things you can change to const
, and this is ready to go.
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.
Looks great, thanks.
Update code in tests/some/fs.write.spec.js to use const/let AND strict mode