code refactoring, added strict mode (#704)
This commit is contained in:
parent
e5481efa9b
commit
fc545ee3c7
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue