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');
|
||||
var expect = require('chai').expect;
|
||||
'use strict';
|
||||
|
||||
const util = require('../lib/test-utils.js');
|
||||
const expect = require('chai').expect;
|
||||
|
||||
describe('fs.close', function() {
|
||||
beforeEach(util.setup);
|
||||
afterEach(util.cleanup);
|
||||
|
||||
it('should be a function', function() {
|
||||
var fs = util.fs();
|
||||
const fs = util.fs();
|
||||
expect(typeof fs.close).to.equal('function');
|
||||
});
|
||||
|
||||
it('should release the file descriptor', function(done) {
|
||||
var buffer = Buffer.alloc(0);
|
||||
var fs = util.fs();
|
||||
const buffer = Buffer.alloc(0);
|
||||
const fs = util.fs();
|
||||
|
||||
fs.open('/myfile', 'w+', function(error, result) {
|
||||
if(error) throw error;
|
||||
|
||||
var fd = result;
|
||||
const fd = result;
|
||||
fs.close(fd, function(error) {
|
||||
if(error) throw error;
|
||||
|
||||
|
|
Loading…
Reference in New Issue