code refactoring, added strict mode (#704)

This commit is contained in:
OlenaVyshnevska 2019-01-31 15:25:57 -05:00 committed by David Humphrey
parent e5481efa9b
commit fc545ee3c7
1 changed files with 8 additions and 6 deletions

View File

@ -1,23 +1,25 @@
var util = require('../lib/test-utils.js'); 'use strict';
var expect = require('chai').expect;
const util = require('../lib/test-utils.js');
const expect = require('chai').expect;
describe('fs.close', function() { describe('fs.close', function() {
beforeEach(util.setup); beforeEach(util.setup);
afterEach(util.cleanup); afterEach(util.cleanup);
it('should be a function', function() { it('should be a function', function() {
var fs = util.fs(); const fs = util.fs();
expect(typeof fs.close).to.equal('function'); expect(typeof fs.close).to.equal('function');
}); });
it('should release the file descriptor', function(done) { it('should release the file descriptor', function(done) {
var buffer = Buffer.alloc(0); const buffer = Buffer.alloc(0);
var fs = util.fs(); const fs = util.fs();
fs.open('/myfile', 'w+', function(error, result) { fs.open('/myfile', 'w+', function(error, result) {
if(error) throw error; if(error) throw error;
var fd = result; const fd = result;
fs.close(fd, function(error) { fs.close(fd, function(error) {
if(error) throw error; if(error) throw error;